8
votes
1answer
330 views

How to make sed omit not matching lines?

In the following example, sed matches lines starting with an a or a c and prints the first character of that line (a or c): $ echo "ag bh ci dj ek fl" | sed 's/\(a\|c\)./\1/' # Matches lines starting ...
0
votes
1answer
111 views

Optimize regex formula for checking filenames

I'm working on a regex formula that will check if the supplied file for processing has either of the following formats: SN1234_filename.pdf SN1234_filename.pdf.zip This is what I have right now: ...
1
vote
1answer
193 views

regex to put an actual newline at every \n

I'm writing a bash script that will deal with blob data that needs to be written to a file. The data inserted into the blob is separated by newlines. The command line mysql -e select blobfield from ...