I have a .txt file in which I have multiple headers, the header record starts with $ symbol...like the first column name is $Account.
I have to keep the header in the first line and delete all the remaining headers which are in the file.
I tried using sort adc.txt | uniq -u , but my file is really big and I don't want to so this..., is there any other way we can delete the header based on the first column i.e $ symbol from all the places except the first place...the first header record should exist for loading my data in to datastge.
$source|ABC|XYZ|DEF|.......|N
10records
$source|ABC|XYZ|DEF|.......|N
1000 records
$source|ABC|XYZ|DEF|.......|N
10000 records
$source|ABC|XYZ|DEF|.......|N
max is like 2 lakh records
$source|ABC|XYZ|DEF|.......|N
I want the out put as
$source|ABC|XYZ|DEF|.......|N
10records
1000 records
10000 records
max is like 2 lakh records
I tried to automate it for all the .txt files in the directory...I am removing the multiple headers from the file and assigning the same file name again with the below script(i.e i am removing the headers from files a,b,c and assigning the same name again to the new files)..I am getting an error like error in line 1...can you pls tell me where I am doing it wrong
while read FILENAME
do
awk 'NR==1 || $1 !~ /^\$/' < "$FILENAME" > > "${FILENAME}.txt