![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find files ONLY in current directory | gio001 | Shell Programming and Scripting | 8 | 06-19-2009 07:58 AM |
| mget * (obtein files from current directory but not the files form sub-directories) | Peter321 | Shell Programming and Scripting | 0 | 03-12-2009 11:59 AM |
| Finding files in current directory when 100,000's files in current directory | kewong007 | Shell Programming and Scripting | 2 | 02-26-2009 03:13 PM |
| List files that are not directories from current directory | beni22sof | UNIX for Dummies Questions & Answers | 2 | 01-06-2009 03:44 PM |
| Searching for files over 30 days old in current directory | cxredd4 | Shell Programming and Scripting | 18 | 06-11-2006 03:16 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I am trying to use a loop to strip of the funny character ^M at the end of all lines in each file found in current directory and I have used the following in a script:
find . -type f -name '*.txt' | while read file do echo "stripping ^M from [$file]..." ex - "$file" > $tempfile %s/^M//g wq! # mv -i "$tempfile" > "$file" done; I got the following error messages instead: 0602-004 The specified address is not valid. ex: 0602-004 The specified address is not valid. teststrip[11]: %s/^M//g: not found. teststrip[12]: wq!: not found. Can anyone help please? Appreciate much! |
|
||||
|
Try this.. Code:
find . -type f -name '*.txt' | while read file do echo "stripping ^M from [$file]..." sed "s/^M//g" file > temp_file mv -f temp_file > file done Note: For ^M do not directly type cap (^) and letter M - use "CNTRL+V and then press enter" you will get ^M character. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|