Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing commas from text file

Status
Not open for further replies.

gfunk123

IS-IT--Management
May 22, 2001
143
GB
Dear all

I have a file which looks like this

xxxxxxxxxxxxxx,xxx,xxxxxxxxxx
xxxxxxxxxxxxxx,xxx,xxxxxxxxxx

etc

basically 14 characters then a comma, three characters, then a comma then 10 characters. We are uploading this file to our mainframe and they want the commas removed, so it looks like this

xxxxxxxxxxxxxxxxxxxxxxxxxxx

Has anybody got any ideas on how to do this?. Note, the file will always be the same format, but will vary in the number of lines


Any help would be greatly appreciated

 
There are two ways to do this...

From within vi:

:%s/,//g

That will remove every "," in the file.

Second way to do this from the UNIX prompt:

sed /,//g inputfile > outputfile

Hope this helps!
 
UUOC:
tr -d ',' < data
vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
gawk:

Code:
awk ' {
    gsub(/,/,&quot;&quot;,$0)
    print
}' filename > outfile
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top