![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to remove old files without recursion? | nir_s | Shell Programming and Scripting | 5 | 04-27-2008 07:43 AM |
| Script to remove log files | kiranherekar | Shell Programming and Scripting | 1 | 03-01-2006 10:24 PM |
| Want to remove files from unix directory | yogi_chavan | HP-UX | 1 | 08-12-2005 01:27 PM |
| remove some files on a condition.. | ST2000 | Shell Programming and Scripting | 4 | 08-27-2002 06:26 PM |
| remove files | Nisha | Shell Programming and Scripting | 7 | 06-25-2002 09:04 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Remove ^M (CR) from Unix Files
Is there any way we could remove the "^M" from files on unix?
and also what is the best way to count the TABS in a TAB delimited file per record? Thanks, AC |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Quote:
Quote:
Code:
nawk -F"`/bin/echo '\t'`" '{print FNR, NF}' myFile
|
|
#3
|
|||
|
|||
|
You can try also :
cat file1 | tr -d "\r" > file2 Regards, Nir |
|
#4
|
|||
|
|||
|
Quote:
Code:
tr -d "\r" <file1 >file2 |
|
#5
|
||||
|
||||
|
Code:
strings file_name > file_name_without_control_chars |
|
#6
|
|||
|
|||
|
sed 's/^M$//' <file> > <newfile>
( "^M" has to be entered as CTRL-M) Alternative possibilities include "dos2unix" and similar programs. Nearly every program is able to remove trailing LF-characters it seems. ;-)) bakunin |
|
#7
|
|||
|
|||
|
You have to use dos2unix (linux) or dos2ux (hp-ux) for this. Encoding is getting different from dos to unix with ^M character.
hth. |
|||
| Google The UNIX and Linux Forums |