Unix Shell - Re: "from the 4th to the end of the line" - a more elegant way to

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > December 2006 > Re: "from the 4th to the end of the line" - a more elegant way to





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: "from the 4th to the end of the line" - a more elegant way to
slystoner

2006-12-11, 7:23 pm

slystoner ha scritto:
> cat file | awk {' print $4" "$5" "$6" "$7" "$8" "$9" ... $n '}
>
>
> Where n is a number that I guess large to be sure that all rest ot the
> line will be printed
>
>
> esample:
>
> INPUT FILE:
> I don't like 2 2 2 2 2 2222222 2 2 22 2 2 2
> one two tree 11111111 111111 1111 111111 11 1 1 1
> hey! hey! hey! BLA BLA BLA BLAAAAA B B B B B
>
> OUTPUT:
> 2 2 2 2 2 2222222 2 2 22 2 2 2
> 11111111 111111 1111 111111 11 1 1 1
> BLA BLA BLA BLAAAAA B B B B B



If the input contains directories and files and I want to remove them
from filesystem, es:

INPUT file:
addUrl BLA BLA "/home/geeky/CCCP.java"
addUrl HMM HMM "/tmp/this is a directory/"
addUrl AIB BAI "/c64/p i n k f l a m i n g o s.sid"


This is my dummy code:

cat "$1" | grep addUrl | cut -d' ' -f4- | while read line; do ls
"$line"; done

(then I will substitute 'ls' with 'rm -r' when it will runs)

but running it, it says:

ls: "/home/geeky/CCCP.java": No such file or directory
etc

and the file exists!
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com