Results 1 to 3 of 3
From a daily file the constituent data needs to be extracted and the resulting file should be renamed. These are the components:
Data extraction:
cut -d, -f 1,28,29 foo.csv > ...
- 05-12-2008 #1Linux User
- Join Date
- Dec 2004
- Posts
- 323
Renaming a file: adding a date
From a daily file the constituent data needs to be extracted and the resulting file should be renamed. These are the components:
Data extraction:
cut -d, -f 1,28,29 foo.csv > foo.txt
Renaming: the following file is executed:
#!/bin/sh
dt=`date +%Y%m%d`
cp foo.txt foo$dt.txt
How can the steps be combined into one line?
Thank you for your information in advance
- 05-12-2008 #2
Use $() to wrap around your executable code:
Code:cut -d, -f 1,28,29 foo.csv > foo$(date +%Y%m%d).txt
Linux User #453176
- 05-12-2008 #3Linux User
- Join Date
- Dec 2004
- Posts
- 323
Thanks, that worked.


Reply With Quote