Mercurial > repos > sem4j > sql_tools
annotate editheader.sh @ 8:51847f1c0acb draft default tip
Uploaded
| author | sem4j |
|---|---|
| date | Mon, 30 Sep 2013 04:09:36 -0400 |
| parents | cae968c828b8 |
| children |
| rev | line source |
|---|---|
| 4 | 1 |
| 2 # USAGE: $ sh editheader.sh "col1 col2 col3" input.txt output.txt 0 | |
| 3 | |
| 4 # 1 HEADER | |
| 5 # 2 INPUT_FILE | |
| 6 # 3 OUTPUT_FILE | |
| 7 # 4 DELETE_FLG | |
| 8 | |
| 9 if [ $4 == 0 ]; then | |
| 10 echo "The first row will NOT be deleted." | |
| 11 echo -e "$1" | cat - $2 > $3 | |
| 12 else | |
| 13 echo "The first row will be deleted." | |
| 14 echo -e "$1" | cat - $2 | awk 'NR!=2 {print}' > $3 | |
| 15 fi |
