LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-09-2005, 06:32 AM   #1
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Rep: Reputation: 31
posting code from command line


A really stupid question: what is the easiest way to post code from command line onto this forums, without using mouse to cut and paste. And possibly using vim to write the posts.

Last edited by frankie_DJ; 08-09-2005 at 07:28 AM.
 
Old 08-09-2005, 06:51 AM   #2
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
if its an error msg then type :

thecommand 2> output.txt

this will put the error message in output.txt
 
Old 08-09-2005, 07:26 AM   #3
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 31
Hi,

I don't mean to be rude but:arere you sure you posted in the right thread? I am looking for a way to interact with this website better, write my posts in vi, write code from command line to the post easily , without copy and paste. Maybe I can do that with some browser feature. Or maybe the best would be subscribing to a thread and use command line email clients like pine or something. Any thoughts?
 
Old 08-09-2005, 09:51 AM   #4
geeman2.0
Member
 
Registered: Feb 2005
Location: Ontario, Canada
Distribution: Gentoo, Slackware
Posts: 345

Rep: Reputation: 30
If you're editing a file called post.txt with vi/vim ,and you want to insert the output of some command into your file, then I would do it this way.

Save your file in vim (using :w )
Then drop to a command line (using :! sh)
Run your command, and append all output back onto your file.
eg. "yourcommand >> post.txt 2>> post.txt"
This will append the output of the command onto the end of your file.
Then type exit and you'll return to vim and the output of the command will magically be at the end of your file

Make sure you use the double chevrons >> as opposed to > or your post will be completely over written by the output, rather than having the output appended to the end.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 08:45 PM
51 characters only in the 1st Line of command line eggCover Linux - General 2 07-29-2004 02:28 PM
C program code to run a Linux command line Linh Programming 10 06-11-2003 02:59 PM
Add lines of code to files from command line robeb Linux - General 2 06-12-2002 04:54 AM
suggestions for subject line when posting. abrakadabra LQ Suggestions & Feedback 14 05-16-2002 10:03 PM


All times are GMT -5. The time now is 02:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration