A Quick Introduction to Unix/exercises4
Appearance
Task Seven
[edit | edit source]Using a text editor (or if you insist cat), create a file called list2 containing the following fruit: orange, plum, mango, grapefruit. Display the contents of list2.
What commands will accomplish task seven?
cat > list2
orange
plum
mango
grapefruit
Task Eight
[edit | edit source]Using pipes, display all lines of list2 containing the letter 'p', and sort the result. Search the file science.txt for the word ‘science’, sort the output and store it in a file (make up your own name for the file)
What commands will accomplish task eight?
% grep 'p' list2 | sort
% grep 'science' science.txt | sort > sortedscience.txt
Task Nine
[edit | edit source]Use the editor Pico to create a text file and name it as you wish. Try changing access permissions on the file you have just created and on the directory archive Use ls -l to check that the permissions have changed.