Hi,
I am new to using sed and I am trying to parse a file. I have a text file with customer information and I need to remove certain lines that do not have certain information. There are 23 lines for each customer record.
So I am trying to keep only the lines that has the customer account number and name (they are both on same line) and another line that has account type.
The lines are as follows:
1234 CustomerName
Account Type: Type1
The information starts at the beginning of each line with other lines between them.
When I try to parse each line one at a time my commands work but when I try to combine them I get a blank output file. I also have another issue where another line has a date (ie: 4/15/09) that will not be deleted because it starts with a number. I have tried to insert {3,4} after the square bracket to say that there should be 3-4 numbers but that did not help either. The file will be blank.
My commands look like this.
Code:
sed '/^[0-9]/!d' < inputfile.txt > outputfile.txt
sed '/^Account/!d' < inputfile.txt > outputfile.txt
I tried to combine them like this but get a blank file.
Code:
sed '/^[0-9]|Account/!d' < inputfile.txt > outputfile.txt
Does anyone know what I might be doing wrong?
Thanks for any help.