Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a "sed -" like operation on Windows?

Tags:

unix

windows

sed

I have a large 55 GB file in which there is a sentence on every line. I want to check if there are any lines that have a dot "." at the end, and then if there is, I want to insert a space before the dot in that line.

Ex: I like that car. Replace with: I like that car .

A space before the trailing dot on every line if there is a dot.

I don't have any cygwin or unix and I use a windows OS. Is there a sed like common that I can do on this 55GB! file?

I tried GetGNUWin32 but I am unable to determine the actual command there.

like image 750
London guy Avatar asked Oct 28 '25 01:10

London guy


2 Answers

Install Perl. Strawberry Perl is probably the best distribution for Windows. http://strawberryperl.com/

To do what you're talking about in Perl, it would be this:

perl -p -i -e's/\.$/ ./' filename
like image 79
Andy Lester Avatar answered Oct 30 '25 13:10

Andy Lester


You can install Cygwin and use sed from there. And here I found Sed for Windows


Edit:
Very Good Answers to your Question: Is there any sed like utility for cmd.exe

(I always prefix stackoverfloew when I search on google. Same I did for you on google: sed on window stackoverflow, but that is different matter)

like image 25
Grijesh Chauhan Avatar answered Oct 30 '25 13:10

Grijesh Chauhan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!