sed Commands

# sed '/awk/d' filename.txt
Remove line that has string "awk"
# sed 's/^ *//g' d.txt > e.txt
To remove all spaces at the begining
# sed 's/^[ \t]+//g'
To remove tabs
# sed 's/`//' b.txt > d.txt
To remove special charecter "`"
# sed -e 's|[,"'\''}]||g'
To remove comma, single quotes('\'') and bracket(})
# sed -i "s/$var1/ZZ/g" "$file"
To pass a variable in sed in a shell script
# sed -i "s/quote me/\"&\"/" "$file"
When you require the quote character in the replacement string, 
you have to precede it with a backslash which will be interpreted by 
the shell. In the following example, the string quote me will be 
replaced by "quote me" in the output
$ sed 's/^/#/' file.txt
#add
#character
Add character (#) at the beginning of each line using sed command 
$ sed 's|$|\/.staging/job*|' userlist1.txt > userlist2.txt
Add text "/.staging/job*" at the end of all lines
sed -e 's|^/user/||g' user_list.txt
eg:
before
/user/xyz
/user/abc
After
xyz
abc
Remove first occourance of '/user/' from txt file
sed '/The second line/,$d' inputfile
This says "delete all lines from the output starting at the 
matched line and continuing to the end of the file".
sed '/The second line/q' inputfile
This says "print all lines and quit when the matched line is
reached" (the -n option (no implicit print) is not used).