Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Linux Command Practice: Searching, Sorting, and Manipulating Files, Assignments of Computer Science

A series of linux commands for searching, sorting, and manipulating text files. The commands cover various techniques such as searching for specific words, displaying lines with specific patterns, sorting files, and creating and managing links. The document also includes examples of creating and extracting tar archives.

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-agj
koofers-user-agj ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 6

Toggle sidebar

Related documents


Partial preview of the text

Download Linux Command Practice: Searching, Sorting, and Manipulating Files and more Assignments Computer Science in PDF only on Docsity! Practice 3 Download file rolllist.txt, search and sort of this file. 1. search โ€œWebโ€ grep Web rolllist.txt 2. search word โ€œWebโ€ and list the line number grep โ€“wn Web rolllist.txt 3. display lines without โ€œWebโ€ grep โ€“v Web rolllist.txt 4. display lines which start with โ€œAโ€,โ€Bโ€,โ€Cโ€, or โ€œDโ€. grep โ€˜^[A-D]โ€™ rolllist.txt 5. display lines which donโ€™t start with โ€œAโ€,โ€Bโ€,โ€Cโ€, or โ€œDโ€. grep โ€˜^[^A-D]โ€™ rolllist.txt 6. display lines which end with โ€œsโ€ grep โ€˜s$โ€™ rolllist.txt 7. display lines which include at least 2 successive โ€œ1โ€ egrep โ€˜111*โ€™ rolllist.txt egrep โ€˜11+โ€™ rolllist.txt 8. search lines which include โ€œViโ€ or โ€œBrโ€ egrep โ€˜Vi|Brโ€™ rolllist.txt 9. search lines which include at least 6 โ€œ0โ€ egrep โ€˜.*0.*0.*0.*0.*0.*0.*โ€™ rolllist.txt 10. search lines which include โ€œ03โ€ or โ€œ033โ€ egrep โ€˜033?โ€™ rolllist.txt 11. sort file sort rolllist.txt 12. sort it in reverse order sort โ€“r rolllist.txt 13. sort on second field sort +1 -2 rolllist.txt 14. set โ€œ,โ€ as separator, sort on second field sort โ€“t, +1 -2 rolllist.txt 15. set โ€œ.โ€ As separator , sort on the third field by numeric order sort โ€“t. +2 -3 โ€“n rolllist.txt 27. use ls โ€“l display attributes of file1 and file1link ls -l file1 file1link 28. remove file1link rm file1link 29. display the content of file1 cat file1 30. use ls-l display file1 ls โ€“l file1 31. create a directory tartest in your home directory mkdir ~/tartest 32. copy all files and directories in your home directory into tartest cp โ€“r ~/* ~/tartest 33. archive tartest to tartest.tar tar โ€“cvf tartest.tar ~/tartest 34. archive tartest to tartest1.tar with gzip option tar โ€“zcvf tartest1.tar ~/tartest 35. display file size of tartest.tar and tartest1.tar ls โ€“l tartest.tar tartest1.tar 36. archive the current directory to current.tar tar โ€“cvf current.tar . 37. create a directory tartest2 in your home directory mkdir ~/tartest2 38. extract tartest.tar tar โ€“xvf tartest.tar 39. copy tartest1.tar to tartest2 and extract tartest1.tar in tartest2 cp tartest1.tar ~/tartest2 cd ~/tartest2 tar โ€“zxvf tartest1.tar
Docsity logo



Copyright ยฉ 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved