Mercurial > repos > sem4j > sql_tools
changeset 4:cae968c828b8 draft
Uploaded
author | sem4j |
---|---|
date | Wed, 25 Sep 2013 02:45:07 -0400 |
parents | abea0f0eb524 |
children | d316d1155e08 |
files | editheader.sh |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/editheader.sh Wed Sep 25 02:45:07 2013 -0400 @@ -0,0 +1,15 @@ + +# USAGE: $ sh editheader.sh "col1 col2 col3" input.txt output.txt 0 + +# 1 HEADER +# 2 INPUT_FILE +# 3 OUTPUT_FILE +# 4 DELETE_FLG + +if [ $4 == 0 ]; then + echo "The first row will NOT be deleted." + echo -e "$1" | cat - $2 > $3 +else + echo "The first row will be deleted." + echo -e "$1" | cat - $2 | awk 'NR!=2 {print}' > $3 +fi