Ans 1: grep -E '^(.)(.).*$'<input.txt Exp 1: grep -E works for matching extended regular expression.

^ starting and Buffered 2 characters after that any number of character can occur but 2nd buffered character should come second last and first should ca m at last before end of line. Ans 2: ls -l | egrep ^- | egrep -o '[^ ]*$' Exp 2: list all files in long listing | select only regular files | select all n on space characters ends with end of line Ans 3: egrep '###BOT_TEXT###lt;H([1-6])>[^###BOT_TEXT###lt;]*###BOT_TEXT###lt;\/H###BOT_TEXT###gt;' Exp 3: Matched pattern when it founds <then buffer if number comes then > and af ter that any character can occur except < when < comes it starts matching </H (1 st buffered character) then > Ans 4(a): egrep "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}" Exp 4(a): any character from set [0-9] can occur at least 1 or at most 3 times s eparated by . (dot) Ans 4(b): grep "\([0-9]\{1,3\}\)..." Exp 4(b): any character from set [0-9] can occur at least 1 or at most 3 times b efore first . (dot) ant it will be buffered which should occur after every . (do t) Ans 4(c): egrep -e '([0-9]|[1-9][0-9]|1[0-9][0-9]|25[0-5]|2[0-4][0-9]).([0-9]|[1 -9][0-9]|1[0-9][0-9]|25[0-5]|2[0-4][0-9]).([0-9]|[1-9][0-9]|1[0-9][0-9]|25[0-5]| 2[0-4][0-9]).([0-9]|[1-9][0-9]|1[0-9][0-9]|25[0-5]|2[0-4][0-9]) Exp 4(c): [0-9] == 0-9 any digit can occur (for 0 to 9) or [1-9][0-9] == for 10 to 99 or 1[0-9][0-9] == for 100 to 199 or 2[0-4][0-9] == for 200 to 249 or 25[0-5] == for 250 to 255 Ans 5: grep "[0-9A-Fa-f]\{2\}:[0-9A-Fa-f]\{2\}:[0-9A-Fa-f]\{2\}:[0-9A-Fa-f]\{2\} :[0-9A-Fa-f]\{2\}:[0-9A-Fa-f]\{2\}" Exp: Any character from this set [0-9A-Fa-f] can occur 2 times separated by : 6 times Ans 6: egrep -e '[a-z0-9\._-%+]+@(iiit\.ac\.in|gmail\.com|yahoo\.com|hotmail\.co m|facebook\.com|yahoo\.in|[a-z]+\.(gov|edu|org))' Exp 6: [a-z0-9\._-%+] == any characters from the set at least once or more @ == followed by @ followed by any one of the given domain names Ans 7: sed 's/\(.\)*//g' Exp 7: substitute if any character comes more then once with it self ( first occ urrence of any character is buffered ) Ans 8: Exp 8: select select find . -name input9|grep -o "[^\/]*\/[^\/]*$"|grep -o "^[^\/]*" first find the desired file with find command for pattern from last so that it contain only one '/' (forward slash) from selected pattern from beginning until a '/' comes

Ans 9:ls -l|grep "^l"|sed "s/->/target:/g"|grep -o "[^ ]*[ ]*[^ ]*[ ]*[^ ]*$"|se d "s/^/source:/g" Exp 9: long listing all the files and select only those lines which contain l at the beginning using sed -> is replaced by 'target:' again using grep matched pattern from last like [anything except spaces][space][ anything except space][space][anything except space]end of line (link1[space]tar get:[space]a.txt$) then beginning of line is replaced by 'target:'

html Exp 11: when < comes pattern starts after that any character can come except < a nd > any number of times after that > and this pattern is substituted by ' '(spa ce) .html >file2.Ans 10: Exp 10: pattern and */ sed -n '/^\/\*[^\*\/]*\*\/$/p' <input.txt by using -n and a parameter to print p sed works similar to grep is like starting with /* then anything can occur any time except * and / should come before end of line Ans 11: sed 's/<[^<>]*>/ /g' new\ file.