Michael Shnitzer
Michael Shnitzer

Reputation: 2505

Regular Expression for Beginning and End of Line

I often find myself changing the delimiter of CSV files from "," to þ¶þ using the following regular expressions:

 s/","/þ¶þ/g
 s/^/þ/
 s/$/þ/

I feel like there should be a simpler way to perform this action without using 3 statements.

Any tips and tricks that can help me out?

Note: Since the question was asked; the reason I need to do this is because there is a popular Litigation Technology software called Concordance which uses "ASCII value (020) or ¶ for the field seperator, ASCII value (254) or þ for the text qualifier" as the seperates.

Upvotes: 0

Views: 357

Answers (1)

Dalibor Novak
Dalibor Novak

Reputation: 595

Have you tried something along this line?

s/","|^|$/þ/

Upvotes: 2

Related Questions