awk 'BEGIN {FS=" ";} {if ($2 == "true") print $1}'
This awk command only prints the first field ($1) of each record (each line of input) that contains the string "true" in the second field. The BEGIN {FS=" "}
statement sets the field separator to a space, so that awk can properly split the input lines into fields. The if ($2 == "true")
statement checks if the second field is equal to "true", and if so, the print $1
statement prints the first field of the record.
This command will only work if the input file is structured in such a way that each line contains at least one field that contains the string "true". If there are no such fields, the command will not produce any output.
If you need to process a file that is structured differently, you may need to modify the command accordingly.
没有搜到相关的沙龙
领取专属 10元无门槛券
手把手带您无忧上云