Prev: GNU Parallel 20100722 released
Next: ulimit question
From: Javas on 23 Jul 2010 05:18 Hi, How to add a prefix and suffix to each line of a text file using unix shell scripting? Input file : Input.txt with contents 1 2 3 Expected output: '1', '2', '3', Regards, DI
From: Radoulov, Dimitre on 23 Jul 2010 05:28 On 23/07/2010 11.18, Javas wrote: [...] > How to add a prefix and suffix to each line of a text file using unix > shell scripting? > > Input file : Input.txt with contents > > 1 > 2 > 3 > > Expected output: > > '1', > '2', > '3', sed "s/.*/'&',/" Input.txt Regards Dimitre
From: Javas on 23 Jul 2010 05:30 On Jul 23, 2:28 pm, "Radoulov, Dimitre" <cichomit...(a)gmail.com> wrote: > On 23/07/2010 11.18, Javas wrote: > [...] > > > How to add a prefix and suffix to each line of a text file using unix > > shell scripting? > > > Input file : Input.txt with contents > > > 1 > > 2 > > 3 > > > Expected output: > > > '1', > > '2', > > '3', > > sed "s/.*/'&',/" Input.txt > > Regards > Dimitre Thank You Mr.Dimitre.
From: hehe2046 on 23 Jul 2010 09:11 I would say: sed -i "s/.*/'&',/" input.txt
From: Kenny McCormack on 23 Jul 2010 09:26
In article <MP6dneh2BdV5CdTRnZ2dnUVZ_sydnZ2d(a)giganews.com>, hehe2046 <user(a)compgroups.net/> wrote: >I would say: sed -i "s/.*/'&',/" input.txt > > Or, more sensibly: awk '{print "\047"$0"\047"}' ... Tip: Avoid cryptic, meaningless tools like "sed" (and friends). -- > No, I haven't, that's why I'm asking questions. If you won't help me, > why don't you just go find your lost manhood elsewhere. CLC in a nutshell. |