General :: Saving Awk Output To File?

Feb 2, 2010

I have a problem with saving output from awk to a file. The commands I tried:

Code:

$ top | awk '/Cpu|Mem/ {if ($1 ~ /Cpu/) {printf strftime("%H:%M:%S")" "; printf strtonum($3)" ";} if ($1 ~ /Mem/) {printf ($5/$3)*100; printf "
";}}' > file.out

and

Code:

$ top | awk '/Cpu|Mem/ {if ($1 ~ /Cpu/) {printf strftime("%H:%M:%S")" "; printf strtonum($3)" ";} if ($1 ~ /Mem/) {printf ($5/$3)*100; printf "
";}}' &> file.out

In both cases file.out is empty. What am I doing wrong?

View 2 Replies


ADVERTISEMENT

Ubuntu :: Saving Output In File

Feb 16, 2010

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:

The output of these 2 commands should come in one txt file continously it should get over write.

View 1 Replies View Related

Software :: Saving Output In One File?

Feb 16, 2010

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

[code]...

View 1 Replies View Related

Applications :: Saving Postscript Output - How To "print To File"

Mar 21, 2010

Been using gv and vi to build a postscript file. Now I would like to save the output of the program to a disk file. My problem is I can't figure out how to "print to a file".

View 2 Replies View Related

General :: Saving The Output Of "ls" Command In Color?

Nov 25, 2010

When I save the output of "ls" command to a "txt" or "rtf" file, the color information is lost. Is there any way to retain the color code of different files/directories obtained by the command "ls --color" while saving?

View 14 Replies View Related

General :: Vim: Jumping From File C1 To File C2 Without Saving C1 First

Jul 31, 2011

Kernel 2.6.21.5, slackware 12.0
Vim 7.1

I do 'vim c1 c2' and I begin copying parts of c2 to c1 (yank, put). Now, each time I go back to c2, I must save c1 first. But it happens that I'm not sure I want to save it. Is there a way to go back and forth between c1 and c2, making changes to one of them, without having to write to disk before switching? Notice the changes must be kept.

View 9 Replies View Related

General :: Saving Notes Against A File ?

Sep 22, 2010

I want to save notes against a file on linux... i want to save meta data about a file..because the file names are restricted in max length...So how to save notes or comments about a file on linux so that it gets saved along with the file itself...I used the notes tab in the file properties dialogbox.. but that way the notes stick to the file only on that OS only.. if i open that file in another linux os.. those comments/notes are gone...Way to embedd these notes into the file so that i dont lose them ever..At lease a solution that makes this possible on switching linux distros. if its not portable enough that these notes stick b/w windows and linux its ok for me.. but atleast if i format my linux os.. atleast i shouldnt lose those important notes..and be able to access on newer linux..

And i also have no idea if this notes tab was implemented to be linked with the OS only.. i dont see much use of it.. and a normal user also has noway to know this.. i also came to know on superuser chat from a buddy.. @Sathya ..this thing is more useless especially if u use ubuntu which has 6 months timeline..and crazy people like me who are always eager to upgrade their os as soon a new one is available..and any way i can search these notes from the terminal?

View 3 Replies View Related

General :: F11 - Do Some Operation After Saving File?

Feb 21, 2010

I'm using fedora 11. I want to do some operation like after saving a file (moving ,copying,..) the system need to ask that "DO you want to encrypt?" . If yes I am able to run the crypt module (which I already implemented..). Is it possible to invoke a encrypt module which I implemented in c language.

View 2 Replies View Related

General :: Change Thunderbird's File Permissions When Saving Attachments?

Jun 29, 2010

I'm using Thunderbird 3.x on Ubuntu (Linux). When I save an attachment to my computer, the file gets saved with only the owner (me) having read/write permissions. In other words, the file gets saved as -rw

Frequently, I want my group to have permission, or to give read permission to everyone. Is there a way to do change Thunderbird's default file permissions so I don't have to do this manually every time?

View 1 Replies View Related

General :: Vim - Avoid Changing A File's Linux Permissions When Saving Over A Samba Connection?

May 28, 2011

I have an Ubuntu development server and a Windows 7 workstation. I use Windows Gvim to edit files on the linux server, over a samba connection.Saving files from Windows change the Linux permissions in weird way depending on the Windows app I'm using and also depending on whether there's a file extension or not.Here are some testsNo extension; Notepad2: 644 to 764

matt@mattserver ~ % ls -l testfile
-rw-r--r-- 1 matt matt 0 2011-05-28 07:09 testfile
--- Save from Windows Notepad2 over network ---

[code]....

View 1 Replies View Related

General :: Data From Input File To Be Taken And Send To Output File?

Jul 24, 2010

I am new to shell scripting.What i am trying is to write a shell script which take the input file and output should like as mentioned below.Output file should have data till SOK (marked in red)from every second line and then the selected data(marked in green) from 4th line.So selected data from 2nd and 4th line in one line of O/P file and then similarly selected data from 6th and 8th line in second line of O/P file.Input File:

3c3
< c1111;11.11.11.11;pOK;SOK:abcde;Universe:aa
---

[code]...

View 14 Replies View Related

General :: Script To Ftp A File To Remote Machine - Log The Output To A File?

Feb 5, 2010

I am using below script to ftp a file to remote machine

Code:

#!/bin/bash
ftp -nv <<EOF
open ${SERVER}

[code]....

When I execute the above file its working fine and displaying output on to the screen. How can I log the output to a file?

View 7 Replies View Related

General :: Get Output File From A Master File?

Aug 3, 2010

having following problem in linux environment.I have a following basic file with name " BASEFILE", as shown example below :

sl.no pol.no name status loan
1 123 rama FORCE 500
2 234 jama LAPSE 800

[code]...

View 12 Replies View Related

General :: Ubuntu Saving A Scan To "Document" File Using A HP Scanjet 3500c ?

Feb 22, 2010

Request help with scanjet 3500c operation. xSane .996 in Ubuntu sees scanjet and scans. As soon as scan completes, the xSane windows(2) disappears and there are no copies in the intended save folder in Documents. Upon original attempt, the xsane windows had an additional third "Preview" window which has not returned since that first scan attempt?

One is not a computer guru by any imagination!

Info; the scanjet worked very well on the other "doze OS" and seems now, does not in the Ubuntu OS. In Doze, there was also a program for a HP PhotoSmart 3200 running and when I added the scanjet it might have been happy with that driver. Currently I do not have access to the driver disc for the 3200 with me. Too, it now takes ~45+ seconds for the scanjet to begin as compared to 2 - 3 seconds on doze.

Some internet self help searching seems to suggest the xSane 1.0.18 is the driver choice to use with the HP 3500c scanjet. When attempting to download, an archive "Failed" notice appears. I am a bit lost from here.

View 1 Replies View Related

General :: Getting The Name Of The Output File?

Nov 2, 2009

have a doubt, suppose in the script i include an exe type of file for ex. ./a.out, which takes input as a pdb file namely 1sn3.pdb, now i want my output text file to contain the name 1sn3.txt , how do i do that using the shell script

View 8 Replies View Related

General :: How To Print Command Output To A File

Apr 29, 2010

I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this.Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?

View 4 Replies View Related

General :: Redirecting Command Output To File?

Sep 19, 2011

This seems so simple when doing it from command line but I'm not able to accomplish it inside a script. I am trying to put output of following command into a text file:

CMD= mysql -uroot -psecret -e 'SHOW SLAVE STATUS G;'
FIL=~/replication-`date +%F`.txt
MAILTEXT=~/mailtext.txt
touch $FIL
$CMD > $FIL

Where FIL is a variable that contains path of the file to which to output command. I am running this command in a shell script from where I want to email contents of $FIL as attachment using mutt. But I am always getting 0 byte file. Also if I examine in directory the file is of 0 byte length.

View 3 Replies View Related

General :: Restrict Output To Display One File Each?

Jul 27, 2010

I use 'grep -Ri "mypattern" .' to search for all files in the current directory recursively that contain "mypattern". But this command returns every single occurence, so that if a given file has several occurences of the pattern, the screen fills up pretty quick. More than likely, there's a way to restrict the output so that it only displays each file once, no matter how many occurences it contains, but I couldn't find how to do it.

View 2 Replies View Related

General :: How To Redirect The Output To Different Column In .csv File?

Apr 25, 2011

I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,

Code:
echo "$a $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of to move the value of $b to the next column? Or is there a good different approach to do it?

View 2 Replies View Related

General :: Output Pid's From Ps To A Comma Delimited File?

Apr 7, 2010

need to monitor pecific processes over a time frame in terms of the amount of memory and cpu usage it utilizes. I can do this using the top -p <pid> option and using ps to retrieve the pid's. However, seeing that the pid's might differ and it needs to be run on about 13 different machines, I would like to write a script for this that can be run at set intervals. My problem that I have is this:

- When running top -p <pid> I can specify a comma seperated list of the processes required to monitor at that specific time.

- I can use ps -ef | grep <process> | grep -v grep| awk '{ print $2 }' to retrive the list of pid's and output this to a file.

However, how can I output these to the file as a comma seperated list without having to manually do this every time? The reason for this is (an example), lets say I want to monitor the cpu and memory usage of postgresql as well as all its child processes, then I would ps grep for postgres and get the list of pid's for instance.This list then needs to be passed to top -p as a comma seperated list of pid's I suspect that awk or sed might have some options available for this but I do not know this well enough.

View 11 Replies View Related

General :: E-Mailing Whole Output Of A File With Crontab

May 3, 2011

I have this code that is 'bashed' regularly with crontab and basically it will send me an E-Mail of most of the output but it misses out some of it!

Here is the crontab code to automatically run the script:

Code:

So that sends me an E-mail with most of the output of the following code:

Code:

It sends me everything up to echo "*******" "Begin compressing and transferring files" "*******" but it wont output the tar bit.. so it should give me a list of files that have been tarred.

View 1 Replies View Related

General :: Send Output To Both The Screen And A Txt File?

Jan 29, 2010

I am currently using this command

Code:

apt-get install samba --force-yes -y > /sambainstall.txt This suppresses the screen output and sends it all to a text file, how do I have both?

View 2 Replies View Related

General :: Check The Output Of Assembly File?

Jan 14, 2011

I have a small doubt regarding Assembly file compilation. I have two .s files. When I compile two .s files I am getting corresponding .o files. But when I compare the both .o files with diff command, it is resulting that two files are differing. How could/ what are commands we should use to understand the difference between two .o file's output.

View 4 Replies View Related

General :: Command To Overwrite File With Sed Output?

Jan 5, 2010

For example I want a file to be processed by sed, and then overwrite the file with sed's output. I would try this:
Code:
sed '<regex goes here>' myfile > myfile
But it doesn't work as expected, instead it empties the file (I am thinking that as the first byte comes out of sed, it overwrites the whole file and sed has nothing more to do). How can I make this work?

View 14 Replies View Related

General :: Meaning Of File Command Output?

Feb 27, 2010

I used the following command

Code:
file /usr/bin/mawk
Output is

[code]...

View 4 Replies View Related

General :: Primitive Way To Output A File To The Printer ?

Jun 13, 2011

What is the most primitive way to output a file to the printer? I mean data transfer from the file to the printer. I suppose it must be 'cp some_file /dev/<printer device>. For the console, I know the devices are /dev/ttyN, N= 1,2,... But I do not know what are the devices for the printer.

View 9 Replies View Related

General :: Parsing Output - End Of File Option ?

Feb 23, 2011

I'm working on a alias/script that will make it easier to look at my environment via the set command.

On my ubunto when running set it also displays some 10 pages of code pertaining to something called "imagemagik". at the end of the output. This code begins with the { character.

This is annoying if I want to look at my environment when working on scripts. How could I use something like grep, awk, sed, or whatever to ignore everything after the "{" character.

That seems to be the simplest way as long as there are no leading brackets in my environment. (And if you're thinking I should just remove {imagemagik}, I might just do that. But I still would like to know how to do this).

View 3 Replies View Related

General :: Can I Force Nohup Output To Screen Instead Of A File

Nov 9, 2010

When I run a script with nohup, the output is forced to the out.log file by default; is there a way to force the output to the screen instead of the file? I need to be able to see when my script gives me a "process started" message, and I don't want to clog up the system with log files.

View 2 Replies View Related

General :: Executing PHP File And Read Output To Program

Jun 29, 2011

I'm using Ubuntu and I'm programing with eclipse CDT. My goal is to execute a php file and read the output to my c++ program. To do so I thought I should use fork(), dup2() and execl. When in shell, the call "php myscript.php" worked just fine, but when in c++ I tried:
execl("usr/bin/php", "php", "home/geiger/workspace/SemiServer/server_content/myscript.php", NULL);
And it didn't work (the process wasn't terminated and I got no output). I tried different version of this call, like losing the "php" string and/or drop "home/geiger" from the path string, to no better result.

View 1 Replies View Related

General :: Show The Output Of Several Vi Files In A Single File?

Jan 3, 2011

i have 10 vi files . these files contain some system related information. i need to combine the output of all these files into a single file. the final file should contain contents of all these 10 files and the output should be in a tabular format.

is there any command in vi that i can use to create a table ?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved