annotate editheader.sh @ 5:d316d1155e08 draft

Uploaded
author sem4j
date Wed, 25 Sep 2013 02:45:30 -0400
parents cae968c828b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
1
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
2 # USAGE: $ sh editheader.sh "col1 col2 col3" input.txt output.txt 0
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
3
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
4 # 1 HEADER
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
5 # 2 INPUT_FILE
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
6 # 3 OUTPUT_FILE
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
7 # 4 DELETE_FLG
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
8
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
9 if [ $4 == 0 ]; then
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
10 echo "The first row will NOT be deleted."
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
11 echo -e "$1" | cat - $2 > $3
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
12 else
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
13 echo "The first row will be deleted."
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
14 echo -e "$1" | cat - $2 | awk 'NR!=2 {print}' > $3
cae968c828b8 Uploaded
sem4j
parents:
diff changeset
15 fi