Posts

Showing posts with the label Unix Tutorial3

Unix Tutorial3 Ans

Unix Tutorial3 Solved 1. Write a command to display content of top three largest file in a working directory. cat `ls -lS | grep -v '^d' | head -n 4 | tail -n 3 | tr -s ' ' | cut -d ' ' -f 9` 2. Count no of words in lines 40 thrugh 60 of file f1.txt sed -n '4,8p' t1 | wc -w 3. Display all filenames not begining with "." find . -maxdepth 1 -type f ! -name '.*' -print 4.Delete all special characters from file f1. tr -cd '[a-zA-Z0-9 \n]' < t1 5.Display i-node no of all files of current directory. find . -maxdepth 1 -type f -ls 6.Display those lines of file f1 that contains exactly 50 characters in it. grep -E '^.{13}$' t1 7. Replace "hello" with "HELLO" in input file fin.sh and write those lines to output file fout.sh. tr 'hello' 'HELLO' < t1 > fout.sh 8.Extract all usernames and their home directories from /etc/passwd. cat /etc/passwd | cut -d ':' -f 1,6 9.Locate lines o...