The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 03-02-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
Quote:
Originally Posted by monicasgupta View Post
wow thanks Perderabo it worked like a charm!!! but it is creating one more extra file also i.e, whatever.txt. I dont want this file. I really appreciate ur input.

39 Mar 2 05:42 100whatever.txt
39 Mar 2 05:42 200whatever.txt
39 Mar 2 05:42 300whatever.txt
2 Mar 2 05:42 whatever.txt

THanks
Monica
you must have some blank lines. You can ignore blank line by checking if the number of fields is non-zero....

awk -v timestamp=whatever 'NF {print $0 >> ($1timestamp".txt")}' data

And you're supposed to replace "whatever" with your timestamp.