Programming :: Modify Output Of Shell Script

Dec 3, 2010

I'm running RHEL5.5 and nagios 3.2.0. The real question deals with how to change the printed output so nagios will work with it.I have made a script that will calculate network throughput on interfaces. The script is going through and finding all interfaces (eth, bond, lan) and doing the math to calculate throughput.The output is mainly for nagios to report and trend the values. As nagios wants to see nothing but perf data after the '|' character, I somehow need to have only one '|' character for all of the output.

View 2 Replies


ADVERTISEMENT

Programming :: Using Sed To Modify Command Output?

Jun 13, 2010

The output of a command changed and I need to extract the data and print it out in a different fassion:

Code:
abcd1=aaaa xx
abcd 2 aaa xx bbb
abcd2=aaaa xy
ab 2 xx aaa bbb ccc xxx
should be transformed to:

[Code]...

Currently I used sed "search1|search2|search3" to get the lines that need to be transformed. But I also need to search for substrings in those lines and I need to print those substrings in a specific order together with other characters. How is this done with sed?

View 7 Replies View Related

Programming :: How To Parse And Modify Keywords Using Shell Script?

Apr 14, 2011

There is a file with that format of each models' information.I don't think that's good format, but I cannot change that format. I needed to modify the model name, 'model = xxx' as 'model = abc'.And I don't know how to parse and modify 'model = iii' and 'model = ddd'.The only clue to parse 'model = ddd' is the second 'model = ' after the second 'system information'. But how to parse the second keyword?Is it possible with 'sed'?I sometimes have to modify the information of the file.using shell script if possible.Python is ok. (Shell script is better for me.)

View 15 Replies View Related

Programming :: Redirect Output To Files Using Shell?

May 21, 2011

I have a huge database of students, I would like extract these data and write to individual file for each students.

I am running a loop in shell program (.sh file), the output of each run in the loop need to redirected to a file with variable name.

I tried the following line, but it did not work, where BodyMsg is the data and Rollno is the students roll number.

echo $BodyMsg > $RolNo".html"

View 5 Replies View Related

Programming :: Shell Script - Redirect Output To File

Sep 6, 2010

I did a select on my db and now I need that this if consult return true for me salve the columns information in file. How I do this in Shell?!

View 3 Replies View Related

Programming :: Shell Script Ssh : Eliminate Login Process Output?

Jun 1, 2009

I use tcl-expect script to ssh to the server. How can I eliminate the first 2 lines if using system(./script.sh) to execute it, as the default output will be shown on shell and the first 2 lines are included.

Essentially I just want to have the "ps" result, not the login process. code...

View 1 Replies View Related

Programming :: Creating Array From Command Output (Bash Shell Script)

Jan 26, 2011

I have a command that outputs n lines of text, and I want to place each line into an array element, but I can't seem to get the syntax correct

So my command is this:
cat $configfile | sed -n '/cluster:'$clustername'/,/cluster/ p' | awk /host/

Which produces many lines depending on the value of $clustername. I'd like to get each line as elements of an array.

View 5 Replies View Related

General :: Modify The Output Of Df Command?

Mar 20, 2010

this is the output of df command on my system

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda8 18073924 4911628 12244184 29% /
udev 642140 308 641832 1% /dev

[code]....

View 14 Replies View Related

Programming :: Show The Output Of Shell Command Into A Textbox, Ex Ps -efc Command?

Oct 20, 2010

I am using gtk to program GUI. How can I show the output of shell command into a textbox, ex ps -efc command ?

View 3 Replies View Related

General :: Modify Loop Code (For And While) To Get Output Returned

Jul 20, 2010

Filename.txt

Code:
My First Line
My Second Line
::::While Loop:::
Program:

Code:
while read line
do
echo "$line"
done < Filename.txt
output:

Code:
My First Line
My Second Line

Is it possible to use for loop to get the same output. I have tried executing below code but I get every word of my file being displayed one below above.Is there any way I can modify the for loop code to get the output returned by while loop?

:::For Loop:::
Program:

Code:
for line in $(cat Filename.txt)
do
echo $line
done
output:

Code:
My
First
Line
My
Second
Line

View 8 Replies View Related

Debian Configuration :: How To Modify Source.list From Shell?

Jan 27, 2011

how can i manually modify source.list to include debian repository from shell.since xorg isn't installed yet and the cd doesn't work well.

View 5 Replies View Related

Fedora :: Modify Start Up Files Of Sh-based Shell

Sep 2, 2011

i need to add a line in the login start up file(s) (one of ~/.bash_profile, ~/.bash_login, or ~/.profile) and startup file run by my shell when started as a non-login shell (~/.bashrc) so as to set up my account envirnoment for one of my courses.I don't know how to proceed with this. I tried doing this in my ubuntu enviroment and my system got locked after that.

View 3 Replies View Related

General :: How To Modify Line Of File Using Shell Script?

Apr 12, 2010

I have a file like below
n
p
1
1
50
w

I need to modify the first occurence of 1 byt some other integer.How do i do it using shell script?Can anybode help me out with that?

View 9 Replies View Related

General :: Modify A File Like /etc/gdm/custom.conf From The Shell Or A Script?

Jun 22, 2010

I want to modify a file like /etc/gdm/custom.conf from the shell or a script.

# GDM configuration storage
[xdmcp]
[debug]
[daemon]
AutomaticLoginEnable=true;
AutomaticLogin=username;

But the idea is that I can add a line to a section and it check if the section is defined, (add the definition if not), the property is defined, let it undefine (erase the line), (and delete the section header if there is no property defined), etc...

I didn't find anything except gconftool-2 but it do not explain how to modify other files. (there is a shema file there).

there isn't a program/script to achieve this, but can easyly be made for every config file, If someone do something like that, with a little database of which markup use each file, it could become really popular.

View 3 Replies View Related

General :: Desire Trick To Modify Hostname In Shell Script

Mar 28, 2011

I am looking an neat trick / elegant solution to manipulate / modify hostname and set a variable to the value inside a script.I have figured what I want to do.I just want to know how to set the variable correctly ?

View 1 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Programming :: How To Modify System Kernel

Dec 7, 2010

For my work, I have to modify the routing lookup process at Linux kernel.

The details is below:

A-----B.

We have pcA, pcB (using Linux OS kernel 2.6.26.5) connect together. We need to modify the source code of kernel at B in order to if A sends the packets with destination IP address as C, pcB still receives this packet and send to transport layer (that means, it bypass the routing lookup process at kernel).

The solution I used as the following code...

View 12 Replies View Related

Programming :: Modify What Already Printed On The Screen?

May 6, 2011

Now we are implementing our own shell using C++. What upseting us is the history command function, we use an array to store the history commands, and print the when receiving the up and down arrow buttons. The problem is we cannot modify the history command already printed on the terminal, we even cannot move the cursur, let alone modifying the command.

View 1 Replies View Related

Programming :: How To Modify ArrayList From Outside Of Class?

Mar 10, 2010

Okay so I'm working on a program here as I'm learning java,I have an array that is initialized with 5 objects that are hard coded. I have made a GUI that takes the input needed and creates an object with those values.I need to add that object to the ArrayList that I have previously made.Okay, so I have three classes, guiclass.java, main.java and gladiator.java Objects are made and defined in "gladiator".Main contains my public static void main section, launches my gui, creates my five hard coded objects, creates my ArrayList and adds my five hard coded objects to the ArrayList.Now, I need to add the object that I generated in the guiSection [action Listener]to the ArrayList that I created in my main class's public static void main string... section. Problem is my arraylist "cannot be resolved" from guiclass.

View 13 Replies View Related

Programming :: Modify Lines That Are Too Long?

May 25, 2010

I have a CDL netlist with 5630 lines. 512 of the lines are over 128 characters. The tool I am using to read in the CDL returns an error for each line over 128 characters.

If the line is too long I can fix it by adding a line continuation symbol, in this case a "/", somewhere prior to the 128th character then a line feed, obviously, and a "+" to the continuation.

example (pretend its a long line);
before;
this line is too long
after;
this line /
+ is too long

Part of the problem is that I can't use a constant point prior to the 128th character because I can't break up a term.

bad;
this line i /
+ s too long

If I can replace the last space before the 128th character with " / + " on all lines that are over 128 characters then I'm golden. I'm not sure if I need to escape the + or not. If so then the substitution is " / + ". And if I use sed then I'll escape the .

View 6 Replies View Related

Programming :: Trying To Modify Code For GBLink?

Apr 12, 2010

I'm trying to modify the code for gblink so that it can read from my usb to parallel port cable. I know that the address for a normal parallel port (/dev/lp0) is 0x3bc, but how can I find out the address for /dev/usb/lp0?

View 6 Replies View Related

General :: Can't See The Output Shell In Child

Feb 4, 2010

I have following script.

Code:

#!/bin/bash
export VAR="shell"
echo " $VAR in parent "
bash
echo "shell in child "

If i execute this script, the output is just

Code:

shell in parent

Why can't I see the output shell in child ?

View 2 Replies View Related

Programming :: If Modify Tcp.c Stack File And How To Compile

Nov 4, 2010

i have just modify tcp.c file in/usr/src/linux/net/ ipv4 location.Now should i compile the complete kernel?if not then how to compile that net/ipv4 package or etc.

View 1 Replies View Related

Programming :: Run Script To Modify Text File?

Mar 20, 2010

I have around 600 empty text files that I need to add the name of this file as part of the data, I mean files from "file1.txt to "file599.txt, all of them empty, and I need to get the name inside the file, so, when I open the file show the name as part of the data "file1".

View 11 Replies View Related

Ubuntu :: Piping The Output Of The Shell To Notify-osd?

Apr 30, 2010

how would you go about piping the output of the shell to notify-osd?

View 5 Replies View Related

Ubuntu :: Emacs -- Run Shell Command W/o Output?

Jul 12, 2011

I write LaTeX in Emacs and then run a shell script to process the LaTeX code. I used to run a subshell buffer with M-x shell and then execute the script from within there, but this results in a lot of switching between buffers, which seems unnecessary. Then, I found out about executing shell commands with M-! cmd RET, as described here:[URL]The problem with this is that the output from the script splits my screen. It's a nuisance, and I would like to run the script without any output. I've tried appending > /dev/null to the command, but it doesn't work.For example, when from within Emacs I enter M-! followed by

Code:
sh make.sh > /dev/null
it splits my screen so that one portion displays output from the make.sh script. I want it to run silently, and leave my Emacs buffers alone

View 3 Replies View Related

Programming :: Parse And Modify File Without Creating A Copy?

Nov 4, 2010

I don't think this is a "perl one-liner" of find and replace. I'm trying to auto-fill some information in a listing of files. The simplest example is that in the files the following exists:

I would want the script to find this and populate it with something like -- Date : 20101004-1758

I have a few more similar fields to autofill, and I'd like to do this from within a larger perl script I'm developing to process these files. So, how I perform in-place file modification from within a perl script?

View 3 Replies View Related

General :: Pipe Output Of Shell Command Into A New Buffer In Vim?

Jun 29, 2010

How can I pipe the output of a shell command into a new buffer in Vim? The following obviously wouldn't work, but you can see what I'm getting at:

:!echo % | :newtab

View 2 Replies View Related

Ubuntu :: Shell Command Output Not Showing Immediately?

Jan 18, 2011

This is an extremely weird issue that I can't find any help with on Google. It is minor but extremely annoying.

When I type in a linux command in the terminal, (e.g. "ls -la"), and then press enter, the cursor goes to the next line and just sits there, as if its processing some long command.

If I press enter again, I see the ls output as well as my prompt twice. It's like the terminal window isn't auto-scrolling, but I've also seen this happen when there wasnt even enough text in the console screen to warrant a scrollbar. Has anyone seen this before and know what I need to do? I hope what I'm asking about makes sense.

View 3 Replies View Related







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