chebe: (Default)
[personal profile] chebe posting in [community profile] command_liners
Hey all, don't think I've seen this here before, and I know there are many ways of doing this, so I thought, in a fit of geekery, that it might be fun to try and collect them all! Afterall everyone does have their own favourite programs.

I posted this at my own journal when I first came across it, but here's a new one as well;

sed -i 's/\r//' $file_name

perl -pi -e 's/\r\n/\n/g' $file_name

Line-Feeds

Date: 2011-04-28 07:18 pm (UTC)
From: [personal profile] babysprite

Thank you for these.

I'll add them to my scripts collection.

Whenever possible, I convert word-processed documents and save text as "US-ASCII" with the Dell Workstation in my office and my PowerBook at home.

My favorite text-editor is vim, for which I use "!fmt" to format text within the document. That usually removes the Windows CR/LF.

Thanks, again.

Robert

Re: Line-Feeds

Date: 2011-04-28 08:27 pm (UTC)
pixel: Age of the geek, baby. (Leverage) (leverage: quoteageofthegeek)
From: [personal profile] pixel
Thanks for the vim tip, will have to remember that.

!fmt

Date: 2011-04-28 11:18 pm (UTC)
From: [personal profile] babysprite

No problem! =)

I like to share what I know with others in the spirit of the g33k community.

I "discovered" !fmt during my first gig in tech, formatting text documents for a teletype printer.

An editor/programmer can use !fmt from the command mode in vim and add a navigational keystroke like *w* *$* *^* *[[* and *]]* depending on much of the text you want to format.

From the command-line, the programmer/editor can use fmt [option][old filename] > [new filename].

Profile

command_liners: A command line prompt with a blinking cursor after it, green against black. (Default)
Command Liners

January 2022

S M T W T F S
      1
2 345678
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 14th, 2025 08:43 am
Powered by Dreamwidth Studios