Observation:
- You have a file which has the "Pipe" symbol <|> as
the "Field Separator".
- Field 4 and 5 are the date in the format : DD/MM/YYYY
- You didnot specify that you want to find the year 1999 in field 4 , or 5, or either, or both .
Answer:
Case 1: Look for "/1999" in either field 4 or 5:
A simple grep can do the job:
cat file_name | grep '/1999'
Explanation: the date has the forward slash in it.
Case 2: Look for "/1999" in field 4 only.
cat file_name | awk -F"|" '( $4 ~ "/1999" ) {print $0}'
Case 3: Look for "/1999" in field 5 only.
cat file_name | awk -F"|" '( $5 ~ "/1999" ) {print $0}'
Case 4: Look for "/1999" in BOTH field 4 and field 5:
cat file_name | | awk -F"|" '( $4 ~ "/1999" ) && ( $5 ~ "/1999" ) {print $0}'
Note:
{print $0} == print the whole line, replace $0 with other number if you want to print certain field only, SEPARATE them by comas.
Ex.: {print $1, $3, $5}
Good luck,