About
Community
Bad Ideas
Drugs
Ego
Erotica
Fringe
Society
Technology
register | bbs | search | rss | faq | about
meet up | add to del.icio.us | digg it
Go Back   Community > Technology > Everything *NIX
Register FAQ Members List Calendar Today's Posts

Everything *NIX This is a general forum about all forms of *nix. Post your ideas and thoughts on this wonderful OS family. Talk about your personal favorite flavor of *nix and why you think it's so much better than the others. Anything pertaining to *nix and *nix administration should be posted here.

Reply
 
Thread Tools Display Modes
  #1   Add zuperxtreme to your ignore list  
Old 2008-05-20, 18:20
zuperxtreme zuperxtreme is offline
Regular
 
Buenos Aires, Argentina Send a message via MSN to zuperxtreme
Question Does anyone use vi(m) ?

I need to find out if it's possible to give a specific format to text files(not necessarily .txt) automatically with vi(m).

Specially command line style, so that I can probably write a crappy batch file...
Reply With Quote
  #2   Add deus-redux to your ignore list  
Old 2008-05-20, 18:22
deus-redux deus-redux is offline
Moderator
 
Great Britain Send a message via AIM to deus-redux Send a message via MSN to deus-redux
Arrow Re: Does anyone use vi(m) ?

You can give the file whatever extension you like. .txt, .bat, .whatever

Just open vim, edit, and do :w filename.extension

Also, *nix please.

-deus-
Reply With Quote
  #3   Add zuperxtreme to your ignore list  
Old 2008-05-20, 18:25
zuperxtreme zuperxtreme is offline
Regular
 
Buenos Aires, Argentina Send a message via MSN to zuperxtreme
Default Re: Does anyone use vi(m) ?

Quote:
Originally Posted by deus-redux View Post
You can give the file whatever extension you like. .txt, .bat, .whatever

Just open vim, edit, and do :w filename.extension

Also, *nix please.

-deus-
Isn't there one for windows?

And you missed my point.

I need to format a file with for example:

2348723564235

to

att+2348723564235

And say that there are 500000 numbers. I can do it manually with UltraEdit, but if I could automate it I'd be a happy camper.

EDIT: Not edit the filename, the actual contents.

EDIT2: I'm not going to be using the Linux one........ -_________________-
Reply With Quote
  #4   Add Prometheum to your ignore list  
Old 2008-05-20, 20:49
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Does anyone use vi(m) ?

There aren't many people who use Vim on windows IME.

But for this you want Perl.
Reply With Quote
  #5   Add zuperxtreme to your ignore list  
Old 2008-05-20, 21:05
zuperxtreme zuperxtreme is offline
Regular
 
Buenos Aires, Argentina Send a message via MSN to zuperxtreme
Default Re: Does anyone use vi(m) ?

Quote:
Originally Posted by Prometheum View Post
There aren't many people who use Vim on windows IME.

But for this you want Perl.
bah... I don't know how to program in Perl and I don't have the time to learn...

I'll stick to the method I'm taking I guess..
Reply With Quote
  #6   Add toolow to your ignore list  
Old 2008-05-20, 22:00
toolow toolow is offline
Regular
 
Columbus IN USA
Default Re: Does anyone use vi(m) ?

This is probably the easiest way to do it:

Code:
:%s/^/\='att+'
Ask in the Windows forum next time, these fools don't know what they're talking about.
Reply With Quote
  #7   Add ArgonPlasma2000 to your ignore list  
Old 2008-05-21, 04:35
ArgonPlasma2000 ArgonPlasma2000 is offline
Moderator
 
҉
Default Re: Does anyone use vi(m) ?

lol, I would have just written out some simple C. Don't know none of those new-fangled scripin' talk.
__________________
How do you kill five billion people? And who will be the ones to die?
Reply With Quote
  #8   Add zuperxtreme to your ignore list  
Old 2008-05-22, 19:41
zuperxtreme zuperxtreme is offline
Regular
 
Buenos Aires, Argentina Send a message via MSN to zuperxtreme
Question Re: Does anyone use vi(m) ?

Quote:
Originally Posted by toolow View Post
This is probably the easiest way to do it:

Code:
:%s/^/\='att+'
Ask in the Windows forum next time, these fools don't know what they're talking about.
Can you explain how that works?
Reply With Quote
  #9   Add Prometheum to your ignore list  
Old 2008-05-22, 20:27
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: Does anyone use vi(m) ?

Quote:
Originally Posted by zuperxtreme View Post
Can you explain how that works?
Code:
:%s/^/\='att+'
It's a regex. It takes the line (%s) and appends att+ to it. Run that in the command mode in vi and it'll apply it globally.
Reply With Quote
  #10   Add toolow to your ignore list  
Old 2008-05-22, 20:47
toolow toolow is offline
Regular
 
Columbus IN USA
Default Re: Does anyone use vi(m) ?

It's just a substitution command. The prefix % is a range representing the entire file (technically 1,$) for the substitution command, s. The first / says we're about to enter the pattern we want to match, which is just ^ meaning start-of-line. The second / says we're going to enter the string we want to match. \= says match as many as possible with 'att+'.
Reply With Quote
This thread continued for 3 pages in the real archive, 21 posts total - only page 1 survived here.
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

 
To the best of our knowledge, the text on this page may be freely reproduced and distributed.
 

totse.com certificate signatures
 
 
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
Hot Topics