Re: fixed-size records



On 9 Mar 2006 03:05:46 -0800, gioparl@xxxxxxxxx wrote:


=CE=9F/=CE=97 Vino =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
gioparl@xxxxxxxxx wrote:
hello!

I have some files with fixed-size records

george jenny lina

I want to convert to

george ,jenny ,lina

how can do it?sed&awk??any help?

thanks!

p.s. it's spaces between fields,not tabs.

sed -e "s_ \([^ ]\)_,\1_g"



thanks a lot! it works:)

but if a field contains two strings seperated by a space?
I would like to use it with parameters(positions)
is there a way to use positions

position 23,56,88 insert a comma
something like that

any idea?


Hi,

Here's a 'sed' solution;

sed "s/./,/23;s/./,/56;s/./,/88"

If you wanted to insert the commas instead
of replacing them, work from back to front
to keep the earlier positions the same;

sed "s/./&,/88;s/./&,/56;s/./&,/23"

seeyafrom
laura

--
echo moc.12klat@daehriaf_arual|sed 's/\(.\)\(.\),*/\2,\1/g;h;s/,//g;/@t/q;G;D'
.



Relevant Pages

  • Re: fixed-size records
    ... Xicheng wrote: ... I have some files with fixed-size records ... p.s. it's spaces between fields,not tabs. ... You are also adding the comma which increases the line length. ...
    (comp.unix.shell)
  • Re: fixed-size records
    ... Vino ??????: ... I have some files with fixed-size records ... p.s. it's spaces between fields,not tabs. ... position 23,56,88 insert a comma ...
    (comp.unix.shell)
  • Re: Trying to fix Invalid CSV File
    ... adapt this to quote fields that contain a comma in them? ... than comma and quote delimited. ... There may be no tabs in *your* data. ...
    (comp.lang.python)
  • Re: [RFC][PATCH 2/2] disable boot interrupts on Intel X58 and 55x0
    ... on one line, with tabs to make for nice columns, I can more easily see ... Firstly I would say these entries aren't consistent at all.. ... comma tab delimited, some are comma space delimited, and some are mixed ... maybe not getting it right (not to mention it's special formatting just ...
    (Linux-Kernel)
  • Re: Code to remove Enter Symbols
    ... delimited by comma. ... account information that has a set format and adds in TABs and Line ...
    (microsoft.public.word.vba.general)