[CentOS] script question

Wed Oct 15 15:29:05 UTC 2008
Les Mikesell <lesmikesell at gmail.com>

Filipe Brandenburger wrote:
> Hi,
> 
> 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

Or sed -e 's/^...................//' <text.txt >output.txt
which might be a nicer starting point if you want to make other changes 
although it won't change a line with less than 19 characters.  If you'd 
want that, 's/^.\{1,19\}//' should do it.

-- 
   Les Mikesell
    lesmikesell at gmail.com