I have a huge text file where I want to print the column contains the word ````
LastRechargeDate= xxxx
where:
xxxx is deferent dates
this word/pattern is mostly can be found in column 13. so, I used the following awk command
nawk -F "," | print '{print $1, $13}'
my issue here is that, the word i want to print in some lines is located in column 23, some lines in column 19
assuming date is not a regex complication ...
awk -F ',' -v Pat="LastRechargeDate= xxxx" ' '$0 ~ Pat { for (i=2;i<NF;i++) if ( $i ~ Pat ) print $1 "," $i }' YourFile
print line and field that CONTAIN your pattern (no only equal)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.