Re: How to append a comma to the end of each line in a file Kruno <krunok@rocketmail.com> wrote:
> Here are a simple script:
>
> #!/bin/ksh
>
> cat file.txt | awk -F: {'print $1","}' > file1.txt
>
> Kruno
>
> "Tony" <zahst@yahoo.com> wrote in message
> news:fd6e5055.0410050626.2beee183@posting.google.c om...
>> I'm try to format some files to use as input for a sqlplus command.
>> The file is nothing but a list of numbers, one per line. I need to
>> place a comma at the end of each line, but I'm not having any luck.
>>
>> My file looks something like this:
>>
>> 123456
>> 112233
>> 1789077
>> 456786755
>>
>> The number could be of varying lenghts, but only one number per line.
>> what I want is something like this:
>>
>> 1234566,
>> 2343535544,
>> 234678,
This works, but classifies for the Useless Use of cat Award. Can
do it with one process, and I think sed is somewhat faster than
awk:
sed -e 's/$/,/' file.txt > file1.txt
HTH, Erik |