LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-16-2010, 01:50 AM   #1
shariefbe
Member
 
Registered: Aug 2008
Location: Tiruchirappalli, India
Distribution: UBUNTU 11.04
Posts: 368

Rep: Reputation: 31
saving output in one file


Hello,
I am using system() command to save command output in txt file and i am storing in one character variable. for example
Code:
system("ls>output.txt");
but what should i do when i have to save another one command output in the same txt file continuously, for example
Code:
system("ls>output.txt");
system("lsmod>output.txt");
the output of these 2 commands should come in one txt file continously it should get over write.
 
Old 02-16-2010, 01:54 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,929

Rep: Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632Reputation: 2632
Basically, '>' will overwrite/replace the content, '>>' will append the content. Just try it at the bash level first.
 
  


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
Saving awk output to file Evgeniy Arbatov Linux - Newbie 2 02-02-2010 08:12 AM
saving xterm output to file khdani Linux - Newbie 1 10-23-2009 06:39 PM
[SOLVED] Saving output without control characters damianpfister Linux - General 7 07-30-2009 05:34 AM
saving output from FIFO? slimshady Linux - Newbie 0 11-29-2007 12:18 PM
Saving the output of a file as a variable mrobertson Programming 5 07-08-2005 01:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:54 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
Open Source Consulting | Domain Registration