Pages

mercredi 2 novembre 2011

examples of GREP usage

1)delete the lines which contains a keyword from a file
grep -v "keyword" filename > newfilename

2)print the first Number of data in the line of file
head -c number file

3) if the keyword to search contains "-", then use the option "-e" such that grep can work.
grep -e "-10" *

Aucun commentaire:

Enregistrer un commentaire