| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| To: | cygwin AT cygwin DOT com |
| From: | robert_neville310 AT yahoo DOT com |
| Subject: | Using dos2unix and attaching it to a while loop |
| Date: | Mon, 09 Apr 2007 00:23:37 -0700 |
| Lines: | 30 |
| Message-ID: | <heqj1318dq537pgisa6q4en46p227nrcll@4ax.com> |
| Mime-Version: | 1.0 |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
I am dealing with DOS text files and need to output DOS text files. This scenario is not about
converting a file in DOS format to UNIX format; or read a file line by line. It relates to using
Unix commands and manipulating a dos file and staying in a dos format
How do you read each line in a while loop?
Do I need to change the IFS or use dos2unix?
How does a Bash script output a DOS text file?
I found dos2unix, but I do not know how to properly implement it. The following Bash code is a
work-in- progress. Please let me know if a more efficient approach exists.
while read line
do
i=0
echo "LINE -> $line"
echo "i -> $i"
MP3[i++]=$(awk '/^.*\.mp3/ { print $1}')
CRC[i++]=$(awk '/^.*\.mp3/ { print $3}')
echo "MP3[i] -> $MP3[i]"
echo "CRC[i] -> $CRC[i]"
done < <(dos2unix "$FILE")
#do some stuff then
unix2dos "$FILE"
The cygwin console returns the following error. My syntax is not correct.
FileRenamer3.sh: line 132: syntax error near unexpected token `<'
FileRenamer3.sh: line 132: ` done < <
(dos2unix "$FILE")'
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |