From: Javas on
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
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
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
I would say: sed -i "s/.*/'&',/" input.txt


From: Kenny McCormack on
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.

 |  Next  |  Last
Pages: 1 2 3
Prev: GNU Parallel 20100722 released
Next: ulimit question