
Untitled
By: a guest on
Apr 24th, 2012 | syntax:
None | size: 0.56 KB | hits: 11 | expires: Never
erasing with sed
sed -i 's/).*/)/' file.txt
cut -d" " -f -3 file.txt
awk -F' ' '{ print $1, $2, $3 }' file.txt
cut -d " " -f -3 FILENAME
$ awk -v n=4 '{for(i=n;i<=NF;i++)$i=""}1' file.txt
$ cat file.txt | tr -s ' ' | cut -d ' ' -f 1-3
echo "a20 is (on) Jan 15" | sed 's/(s*S*){2}$//'
a20 is (on)
echo "a20 is (on) Jan 15" | sed 's/(S*(s*S*){2}).*/1/'
a20 is (on)
sed 's/^([^ ][^ ]* [^ ][^ ]* [^ ][^ ]*).*/1/' file.txt > newfile.txt
sed -r 's/^([^ ]+ [^ ]+ [^ ]+).*/1/' file.txt > newfile.txt
cut -f-3 -d" " file.txt > newfile.txt