Re: script question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hello Jerry-

Simply change the line:

         newline=`echo $LINE | cut -f 19-`

to this:

         newline=`echo $LINE | cut -c 19-`

You want to cut based on 'c'haracters, not 'f'ields.  :-)

Tim Nelson
Systems/Network Support
Rockbochs Inc.
(218)727-4332 x105

----- "Jerry Geis" <geisj@xxxxxxxxxxxxxxx> wrote:

> Hi all,
> 
> 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.
> 
> I am missing something easy but I am not seeing it.
> 
> Jerry
> 
> ---
> I tried the script below but did not work.
> 
> rm  output.txt
> cat test.txt | \
> while read LINE
> do
>         newline=`echo $LINE | cut -f 19-`
>         echo $newline >> output.txt
> done
>            
> test.txt is below 
> 10-Oct-08 08:14 am  10
> 10-Oct-08 08:20 am  20
> 10-Oct-08 08:24 am  30
> 10-Oct-08 08:29 am  40
> 10-Oct-08 08:34 am  50
> 10-Oct-08 08:39 am  60
> 10-Oct-08 08:44 am  80
> 10-Oct-08 08:49 am  10
> 10-Oct-08 08:54 am  10
> 10-Oct-08 08:56 am  10
>  
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux