Quantcast
Channel: Sed not outputting matches from regex to file - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 4

Sed not outputting matches from regex to file

0
0

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.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images