pattern search

sed -e 's/pattern1/pattern2/g' file1 > file2

set x = 2 # variable

sed -e "s/pattern1/${x}/g" file1 > file2

sed -i 128,+23d inputfile # delete 23 lines starting from line 128 of inputfile

tail -n 100 inputfile > outputfile # take the last 100 lines of inputfile into outputfile

cut -d " " -f 2- inputfile > outputfile # cut columns of inputfile, save from fileds 2. separator between fields is space " "

cat inputfile| awk '{ print $7 }' > outputfile # take column 7 of inputfile and put it in outputfile

perl -ne 'print if $. % 3 == 1' < input.txt > output.txt # output every 3 lines of input.txt to output.txt

grep '^6500' input.txt > output.txt # grep lines starting with 6500

grep '6500$' input.txt > output.txt # grep lines ending with 6500

grep -v 6500 input.txt > output.txt # grep lines not containing 6500

paste file1 file2 | column -s $'\t' -t > file # paste file2 to the right of file1 column-wise and store in file

ls -l directory | wc -l # count number of files in folder