I have a file (data.txt) which contains strings like this:
[?1h=
=> ["AD070517",
"AD070518",
: ESCESCOOBB "AD070809",
"NE0000013",
"NE0000014",
: ESCESC[[66~~ "LG100085-097",
"LG100085-098",
]
I am attempting to extract only the entries from the array (minus the double quotes) using the following command:
sed -r 's/([-A-Z0-9]+)"/\1/g' data.txt > clean.txt
According to this regex snippet, that control group and match works as expected, and from what I understand of this post I should be able to output only the matches from sed and direct the output stream to a new file, but the resulting clean.txt file is an exact copy of data.txt with nothing filtered out.
grep -Po '[-A-Z0-9]+(?=")' data.txt > clean.txt
– GrayedFox May 16 '19 at 13:42