comparison editheader.sh @ 4:cae968c828b8 draft

Uploaded
author sem4j
date Wed, 25 Sep 2013 02:45:07 -0400
parents
children
comparison
equal deleted inserted replaced
3:abea0f0eb524 4:cae968c828b8
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