The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #2 (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,114
This is one line with awk...
Code:
$ ls
data
$
$
$
$
$
$ cat data
100 ABC A123
100 BVC D234
100 BNC N324
200 CBC A122
200 AVC D294
200 HNC N324
300 GBC A173
300 FVC D234
300 DNC N344
$ awk -v timestamp=whatever  '{print $0 >> ($1timestamp".txt")}'  data
$ ls
100whatever.txt 200whatever.txt 300whatever.txt data
$ cat 100whatever.txt
100 ABC A123
100 BVC D234
100 BNC N324
$