Вам не нужны sed
или awk
, простой cut
подойдет:
cut -f2 infile
Если вы хотите использовать awk, можно указать разделитель либо с помощью аргумента -F
, либо как FS =
постфикс:
awk -F '\t' '{ print $2 }' infile
Или:
awk '{ print $2 }' FS='\t' infile
"Here's the field of the text, also contains comma"
"Here's the field of the text, also contains comma"
"Here's the field of the text, also contains comma"
"Here's the field of the text, also contains comma"
Если двойные кавычки в файле согласованы, то есть в полях нет встроенных двойных кавычек, вы можете их использовать в качестве разделителя и избегайте их использования в выводе, например:
cut -d\" -f4 infile
awk -F\" '{ print $4 }' infile
Here's the field of the text, also contains comma
Here's the field of the text, also contains comma
Here's the field of the text, also contains comma
Here's the field of the text, also contains comma