Useful Unix/Linux commands at your finger tips
1. How to find files and operate some command on that file list
Example (a) Find all files updated within the last 11 minutes, and copy them to another directory:
find . -mmin 11 -exec cp '{}' /home/temp/ \;
2. How to read a file line by line through a unix/linux shell script
http://www.bashguru.com/2010/05/how-to-read-file-line-by-line-in-shell.html
3. How to extract only the file names after you have figured out which files from the ls -ltr listing
Assume filelist.txt contains the ls- ltr output redirected
cat filelist.lst
-rw-r----- 1 oraxxxx emsxxxx 2119 Dec 5 02:50 sid_ora_5565.trc
-rw-r----- 1 oraxxxx emsxxxx 11591 Dec 5 02:50 sid_ora_24464_TEST.trm
-rw-r----- 1 oraxxxx emsxxxx 469796 Dec 5 02:50 sid_ora_5565_TEST.trc
-rw-r----- 1 oraxxxx emsxxxx 698558 Dec 5 02:51 sid_lgwr_6551.trc
-rw-r----- 1 oraxxxx emsxxxx 5855 Dec 5 02:52 sid_ora_31733_TEST.trm
-rw-r----- 1 oraxxxx emsxxxx 12321 Dec 5 02:52 sid_ora_29474_TEST.trm
cat filelist.txt | cut -d ":" -f 2 | cut -d " " -f 2 > fileslist.txt
Now fileslist.txt will have only the filenames
cat fileslist.tst
sid_ora_5565.trc
sid_ora_24464_TEST.trm
sid_ora_5565_TEST.trc
sid_lgwr_6551.trc
sid_ora_31733_TEST.trm
sid_ora_29474_TEST.trm
4. How to convert from postscript to pdf format
Ensure you have ghostscript installed
Then use the ps2pdf command
ps2pdf -dEmbedAllFonts=true -dOptimize=true -dUseFlateCompression=true myfile.ps
This will create a pdf file with the same name as the .ps file, in the current working directory.
[This page gives a detailed overview of the ps2pdf command.]
...to be continued...