[CentOS] script question

Filipe Brandenburger filbranden at gmail.com
Wed Oct 15 14:59:40 UTC 2008


On Wed, Oct 15, 2008 at 10:48, Jerry Geis <geisj at pagestation.com> wrote:
> I am trying to create a script that takes an entire file,
> drops the first 19 characters from each line and creates a new file.
>       newline=`echo $LINE | cut -f 19-`

What you want is "cut -c 19-" (-c as in characters) and not "cut -f
19-" (-f as in fields).

>       echo $newline >> output.txt

This will also remove the spacing. You should at least use echo
"$newline" >>output.txt, but in any case it's silly as you can just:

cut -c 19- <test.txt >output.txt


More information about the CentOS mailing list