Posts

Showing posts with the label grep

grep and AND Operator!

This achieves what an AND operator should have done in grep! for i in $(grep -l string1 /path/to/files/*)   do     grep -l string2 $i   done

Remove the First N Characters From a Line

The following codes remove first 6 characters. Change the number accordingly... cut -c7- ' this works rr ^.{6} ' rr was not installed colrm 1 6 rr s/^.{6}// sed's/^.\{6\}//' perl -pe's/^.{6}//' ruby -pe'sub /^.{6}/,""' gawk'BEGIN{FIELDWIDTHS="6 999"}{print$2}'