[KLUG Members] Parsing a Text file

Patrick McGovern pmcgover at gfs.com
Wed Jul 20 14:12:49 EDT 2005


The sed command can be handy for small  tasks.  You could use a modification of the command below:
#> sed 's/\(.\{2\}\)/&,/;    s/\(.\{6\}\)/&,/'   file_name

Just change the number inside the brackets where you want the comma to go...  
If you have a 3 line file with "1234567890" on each line the output would be: 
12,345,67890
12,345,67890
12,345,67890




More information about the Members mailing list