The output you want, by the way, can't be used for import into excel... how would it tell the difference between cell-separating spaces and word-separating spaces? So I've given you what you originally asked for, CSV, as in "Comma-separated value". Excel can import that easy.
Thanks a ton .. It works like a charm .... Can you explain me the script when you have time or give me a link where I can read more about writing awk scripts ?
Thanks a ton .. It works like a charm .... Can you explain me the script when you have time or give me a link where I can read more about writing awk scripts ?
The basic principle is that awk is one big loop of its own. It runs each outside code-block found in the script, in order, for every line it processes. You can put expressions in front of them to control when they're run, store things in variables, and so on.
It also understands columns. $1, $2, $3 and so forth refer to columns. Usually, it figures that any whitespace splits a column, but here I've told it specially that it has to be two or more spaces ( FS=" *" ). You can also transform what columns it prints out (OFS=",") and what splits lines on the way out (ORS="\r\n").
And a lot more. Even the meaning of 'line' can be altered, if you needed to use "*" instead of \n.
It has associative arrays, so you can do things like A["string"]=32; print A["string"]; and get 32 out of it.
You can even do shell-like redirection in it, in case you wanted to write to anything but stdout. print > "filename" Once you start writing to a file, it stays opened.
Dear friends,
I'm struggling to preparing a bunch of gromacs input files, say manually. It's really a time-consuming work without any techniques. I suppose that it could be done by a smart script automatically. But I lack some basic knowledge on scripting. Please help!
My original input looks... (3 Replies)
Hi Guys,
I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts.
I used below but it is not working:
OFILE=/home/home1/report1
echo "report1 details" > $OFILE
=/home/home1/1.sh > $OFILE
echo... (7 Replies)
Hello,
I know this should be simple but cant find a solution yet.I have the following in a sh script called "var"
#!/bin/bash
var1=0
And on another script called "main" I use a if construct:
#!/bin/bash
. var
if
then
Do this
else
do that
fi
Now in "do this" part,I have to change... (8 Replies)
Hi guys,
been scratching round the forums and my mountain of resources.
Maybe I havn't read deep enough
My question is not how sed edits a stream and outputs it to a file, rather something like this below:
I have a .txt with some text in it :rolleyes:
abc:123:xyz
123:abc:987... (7 Replies)
Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions.
... (4 Replies)
Hi All,
I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file.
Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
I have the following cron task set to run every 15 minutes to ascertain how many users are in the system and append the result to the log.
/home/pronto/cus/whoisinc >> /home/pronto/cus/whoisin.log
This is the whoisinc script
date +"%d-%m-%Y,%k:%M,Pronto Users,`prowho -s | grep -v... (1 Reply)
Friends,
I have a file with contents like:
interface Serial0/4/0/0/1/1/1/1:0
encapsulation mfr
multilink
group 101
Now I need to manipulate the file in such a way that to all the numbers less than 163, 63 gets added and to all numbers greater than 163, 63 gets deducted.(The numbers... (2 Replies)
I am trying to insert tab's in place of spaces when I tail -f a log and pipe it with grep and cut. Is there a way to take the stdout and format in a way that is tabbed so that all the information is stacked appropriately. I've tried using unexpand. But that did not work. I basically need to... (2 Replies)
I have a file containing two fields, Name and Time, with about 57 lines in this file. I am struggling to create a loop that will cut out the first ten lines of this file and echo it to the screen. Can anybody help me please. (1 Reply)