Monday, April 28, 2008

Linuxgym-Chap4

http://www.ibm.com/developerworks/aix/

Q2 : Character count piping
Experiment by using the command "cat | wc -m", typing a few lines, and then using ctrl-D to return to the command prompt. This outputs a single number indicating the number of characters you've typed. Unlike the previous question, no filename is printed.
Modifying this technique, store the number of characters of the file /usr/local/linuxgym-data/gutenberg/0ws0310.txt into a file called "pipecount.txt" with no other text, such as the filename.

A:
wc -m /usr/local/linuxgym-data/gutenberg/0ws0310.txt ---> count characters
echo [number of charater] > pipecount.txt
Q4:View the end of a file
Store the last 103 lines of the file "/usr/local/linuxgym-data/gutenberg/4mwsm10.txt" into the file "lastlines.txt". Note that this should include both non-empty and empty lines
A :

tail -n103 /usr/local/linuxgym-data/gutenberg/4mwsm10.txt > lastlines.txt

Q5:Append the output
Copy the file /usr/local/linuxgym-data/census/a-j_malenames.txt to a file called appendix.txt in your ch4-pipewild directory. Append to appendix.txt the contents of /usr/local/linuxgym-data/census/k-z_malenames.txt making no other modifications.

A:
cp usr/local/linuxgym-data/census/a-j_malenames.txt appendix.txt
cat /usr/local/linuxgym-data/census/k-z_malenames.txt >> appendix.txt

Q6:

No comments: