Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ls to grep to FTP

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Each day our system produces many outputs which are copied to the /usr/spl directory.
I have been tasked with pulling out certain files and transfering them over to a PC for analysis. This is how I think I should tackle it, help with the
commands appreciated.

List files with only today's date (is this possible?)
Send the output to grep and find the files containing the keyword I'm looking for.
Join the files together and transfer that file over to the PC using FTP or Kermit.

Again, any help appreciated
Malc.




 
Malc,

This should get you started:

[tt]----------------------- 8< ------------------------
#!/bin/ksh

TODAY=`date | cut -c5-10`
FILENAME=todays_files.tar.Z

tar cvf - `ls -l | grep &quot;$TODAY&quot; | awk '{print $NF}'` | compress -c > $FILENAME


ftp -n hostname << HERE
user username password
bin
put $FILENAME
HERE
----------------------- 8< ------------------------[/tt]

If you have any queries about any part of the script, just ask. You may prefer to use zip instead of tar/compress but you can quite happily view .tar.Z files using WinZip anyway.

Note

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top