Предположим, у меня есть следующий файл:
Код: Выделить всё
# sed makes the invisibles visible...
# ∙ is a space; \t is a literal tab; $ is line end
$ sed -E 's/\t/\\t/g; s/ /∙/g; s/$/\$/' f.txt
a\t∙∙b∙c\td∙_∙e$
a∙∙∙b∙c\td∙_∙e$
∙∙∙a∙∙∙b∙c\td∙_∙e$
a∙∙∙b_c\td∙_∙e\t$
abcd$
разделителя из одного или нескольких символов из набора [\s_].
С помощью gawk вы можете:
Код: Выделить всё
gawk '{
printf "["
n=split($0, flds, /[[:space:]_]+/, seps)
for(i=1; i
Подробнее здесь: [url]https://stackoverflow.com/questions/78988304/split-on-regex-more-than-a-character-maybe-variable-width-and-keep-the-separa[/url]