04-29-2009
Help needed on SED
Hi,
I would like to process one file which looks like this :
09-04-16-17:11:53 -> count 1
NAME CHAN QID NMSGS NBYTES MAXBYTES P/T
W_DEALNUM 105 123508770 1 10 14 P
W_APPSTAT 106 123508771 1 12 35 P
W_QSTATUS 107 123508772 1 451 605 P
W_QSTATXX 108 123508773 1 2 905 P
W_QSTAT 109 123508774 1 241 245 P
W_QSTATXY 110 123508775 1 2 605 P
W_WORK 111 123508776 1 51 5500 P
W_CHKP 112 123508777 1 5 55 P
W_QUEUE30 270 100664459 14 294 25000 P
WSS Region Mailbox Totals: 22 messages, 1068 bytes
09-04-16-17:11:58 -> count 2
NAME CHAN QID NMSGS NBYTES MAXBYTES P/T
W_DEALNUM 105 123508770 1 10 14 P
W_APPSTAT 106 123508771 1 12 35 P
W_QSTATUS 107 123508772 1 451 605 P
W_QSTATXX 108 123508773 1 2 905 P
W_QSTAT 109 123508774 1 241 245 P
W_QSTATXY 110 123508775 1 2 605 P
W_WORK 111 123508776 1 51 5500 P
W_CHKP 112 123508777 1 5 55 P
W_QUEUE30 270 100664459 14 294 25000 P
WSS Region Mailbox Totals: 22 messages, 1068 bytes
into this
09-04-16-17:11:53 W_DEALNUM 105 123508770 1 10 14 P
09-04-16-17:11:53 W_APPSTAT 106 123508771 1 12 35 P
09-04-16-17:11:53 W_QSTATUS 107 123508772 1 451 605 P
09-04-16-17:11:53 W_QSTATXX 108 123508773 1 2 905 P
09-04-16-17:11:53 W_QSTAT 109 123508774 1 241 245 P
09-04-16-17:11:53 W_QSTATXY 110 123508775 1 2 605 P
09-04-16-17:11:53 W_WORK 111 123508776 1 51 5500 P
09-04-16-17:11:53 W_CHKP 112 123508777 1 5 55 P
09-04-16-17:11:53 W_QUEUE30 270 100664459 14 294 25000 P
09-04-16-17:11:58 W_DEALNUM 105 123508770 1 10 14 P
09-04-16-17:11:58 W_APPSTAT 106 123508771 1 12 35 P
09-04-16-17:11:58 W_QSTATUS 107 123508772 1 451 605 P
09-04-16-17:11:58 W_QSTATXX 108 123508773 1 2 905 P
09-04-16-17:11:58 W_QSTAT 109 123508774 1 241 245 P
09-04-16-17:11:58 W_QSTATXY 110 123508775 1 2 605 P
09-04-16-17:11:58 W_WORK 111 123508776 1 51 5500 P
09-04-16-17:11:58 W_CHKP 112 123508777 1 5 55 P
09-04-16-17:11:58 W_QUEUE30 270 100664459 14 294 25000 P
could you please help me..?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I need to insert a line into a file underneath an existing line in the file, but am unsure as to the syntax. I'm pretty sure sed can be used though, although any ideas are more than welcome. For example:
File
----
Line 1
Line 2
Line 3
Line 4
Line 6
I need to say: Insert "Line 5"... (1 Reply)
Discussion started by: danhodges99
1 Replies
2. Shell Programming and Scripting
Could someone tell me how to replace varibles using SED inside Korn Shell?
e.g. I have a ksh file program.ksh below:
------------------------------------
#!/bin/ksh
sed -n '/ABC/p' $1 > output.txt
if ]
then
status=new
elif ]
then
status=old
fi
sed -n '/$status/p' $1... (5 Replies)
Discussion started by: stevefox
5 Replies
3. Shell Programming and Scripting
Hi All,
i have one file and in that i have to read each line and do some replacement.
its is not fixed the number or column always be same it can be less also
exm
a;b;c;d;e;f (line)
i have to do something like
In the line
If c is present
then
go to end of line and append ';date'
else... (9 Replies)
Discussion started by: ravi.sadani19
9 Replies
4. Shell Programming and Scripting
Hi,
I have a file in a form of
jkkhjjk1:!:jkhdjkhjkh2:!:kljkljkljklj3:!:kljsdj4
kljlkfljf5:!:kjljljlj6:!:jhjkhjkh7
I am trying to use sed command such that everytime it find ":!:" it will removes it and print remaining of the line on the new line
Output that I need will look like following... (8 Replies)
Discussion started by: arushunter
8 Replies
5. Shell Programming and Scripting
Hi,
I have the following texts :
#1#http://www.google.com#2#Google#3#
#1#http://www.aol.com#2#AOL#3#
I need a bash script which extracts the text between the markers (marks are #1#,#2#,#3#).
I also need that text in variables ($URL and $DESCRIPT will be fine) so I can later use it to... (3 Replies)
Discussion started by: tcp27br
3 Replies
6. UNIX for Dummies Questions & Answers
I am trying to retrieve part of a line from /boot/grub/menu.lst
The line is :
gfxmenu (hd0,0)/usr/share/gfxboot/themes/pclinuxblue/boot/message
I have figured out how to get this line into a file by itself.
sed '/gfxmenu/ !d' /boot/grub/menu.lst > /tmp/menu.lst.pcl_tc
What I need to... (2 Replies)
Discussion started by: Tide
2 Replies
7. Shell Programming and Scripting
Hi All ,
I have a input file which has set of lines like this ::
cat a.txt
unix1 djkdfkjdkkdfkdjfdfkjd 09191091 unix@unix.com <2008-23-07>
unix 2 dfdfdfdfdfdfdfdfdfd
unix3 dfldfljdflkjdfldfkljdfldjfl 0565606 unix1@unix.com <2008-10-09>
unix4 dfdlfndfldflnlffddfd
for some... (4 Replies)
Discussion started by: raghav1982
4 Replies
8. Shell Programming and Scripting
Hello!
I have a "problem" with sed... In a log, I'm wondering how to have the name of the application when "INCIDENT" is in the file...
The name of the application is before "INCIDENT".
For this example, The result should be "SPVP0005"
thanks for your help! (7 Replies)
Discussion started by: Castelior
7 Replies
9. Shell Programming and Scripting
I have file with following contents;
127.0.0.1 www.google.com
127.3.3.1 www.cisco.com
127.3.5.1 www.msnbc.com
I want output as
127.0.0.1 www.google.com google.com
127.3.3.1 www.cisco.com cisco.com
127.3.5.1 www.msnbc.com msnbc.com
I tried
sed 's/www.//g'... (5 Replies)
Discussion started by: sangfroid
5 Replies
10. Shell Programming and Scripting
I want to search texts between first occurence of the matching pattern and replace it with some other text.pls advice what can be done. I searched alot, i could not find anything relevant.
Ex my input is as follows:
red
yellow
grey
white
blue
red
pink
violet
white
I want to search... (9 Replies)
Discussion started by: sangitajc
9 Replies
PERROR(3F) PERROR(3F)
NAME
perror, gerror, ierrno - get system error messages
SYNOPSIS
subroutine perror (string)
character*(*) string
subroutine gerror (string)
character*(*) string
character*(*) function gerror()
function ierrno()
DESCRIPTION
Perror will write a message to fortran logical unit 0 appropriate to the last detected system error. String will be written preceding the
standard error message.
Gerror returns the system error message in character variable string. Gerror may be called either as a subroutine or as a function.
Ierrno will return the error number of the last detected system error. This number is updated only when an error actually occurs. Most
routines and I/O statements that might generate such errors return an error code after the call; that value is a more reliable indicator of
what caused the error condition.
FILES
/usr/lib/libU77.a
SEE ALSO
intro(2), perror(3)
D. L. Wasley, Introduction to the f77 I/O Library
BUGS
String in the call to perror can be no longer than 127 characters.
The length of the string returned by gerror is determined by the calling program.
NOTES
UNIX system error codes are described in intro(2). The f77 I/O error codes and their meanings are:
100 ``error in format''
101 ``illegal unit number''
102 ``formatted i/o not allowed''
103 ``unformatted i/o not allowed''
104 ``direct i/o not allowed''
105 ``sequential i/o not allowed''
106 ``can't backspace file''
107 ``off beginning of record''
108 ``can't stat file''
109 ``no * after repeat count''
110 ``off end of record''
111 ``truncation failed''
112 ``incomprehensible list input''
113 ``out of free space''
114 ``unit not connected''
115 ``invalid data for integer format term''
116 ``invalid data for logical format term''
117 ``'new' file exists''
118 ``can't find 'old' file''
119 ``opening too many files or unknown system error''
120 ``requires seek ability''
121 ``illegal argument''
122 ``negative repeat count''
123 ``illegal operation for unit''
124 ``invalid data for d, e, f, or g format term''
4.2 Berkeley Distribution June 7, 1985 PERROR(3F)