01-27-2009
I don't see a compelling reason to make the grep string more complicated than
just "Ethernet".... but.... here ya go:
grep Ethernet.*\"\" original_log_file |
cut -d' ' -f2 > a
for line in `cat a`; do
#----------------------------------------------------------------------#
# more finds the first instance of string... #
#----------------------------------------------------------------------#
more +/"$line" original_log_file |
head -15 |
egrep '(packets input|input errors|decode)' > b
#----------------------------------------------------------------------#
# Now all the information for a given Ethernet thing is in file b. #
#----------------------------------------------------------------------#
packets=$( awk '/packets input/ { print $4 }' b )
errors=$( awk '/input errors/ { print $1, $4, $6, $8, $12 }' b )
decode=$( awk '/decode/ { print $1 }' b )
#----------------------------------------------------------------------#
# Print some legible output. #
#----------------------------------------------------------------------#
echo For $line . . .
echo packets: $packets
echo errors: $errors
echo decode: $decode
echo =-------------------------------------
done
Obviously modifiy the echo's however you'd like.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I'm having some trouble reading a file that was 'cat' through a while loop. Can anyone suggest alternatives? what i do is
cat filename|grep *.stuff
while read line
do
echo $line
... and other commands
done
The cat,grep line seems to work correctly, but the script hangs when i add in... (3 Replies)
Discussion started by: chugger06
3 Replies
2. Shell Programming and Scripting
Hello,
I have two files that I need to compare and print out the line from file2 that has the first 6 fields matching the first 6 fields in file1. Complicating this are the following restrictions
1. file1 is only a few thousand lines at most and file2 is greater than 2 million
2. I need to... (7 Replies)
Discussion started by: gillesc_mac
7 Replies
3. UNIX for Advanced & Expert Users
File 1
<html>ta da....unique file name I want to give file=>343...</html>
<html>da ta 234 </html>
<html>pa da 542 </html>
and so on...
File 2
343
234
542
and so on, each line in File 1 one also corresponds with each line in File 2
I have tried several grep, sed, while .. read, do,... (4 Replies)
Discussion started by: web_developer
4 Replies
4. Shell Programming and Scripting
I am using the while-loop to read a file.
The file has lines with null-terminated strings (words, actually.)
What I have by that reading - just a first word up to '\0'!
I need to have whole string up to 'new line' - (LF, 10#10, 16#A)
What I am doing wrong?
#make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies
5. UNIX for Dummies Questions & Answers
i have a file with some data and i need replace a perticular value with some other value from another another file
req:
file1.txt
abc,idle.txt,1234
file2.txt
5678
now the requirement is need to replace the "idle.txt" is with "mike_5678" here 5678 from file2.txt...
file2.txt contains only... (2 Replies)
Discussion started by: dssyadav
2 Replies
6. Shell Programming and Scripting
Good day,
I have a list of regular expressions in file1. For each match in file2, print the containing line and the line after.
file1:
file2:
Output:
I can match a regex and print the line and line after
awk '{lines = $0} /Macrosiphum_rosae/ {print lines ; print lines } '
... (1 Reply)
Discussion started by: pathunkathunk
1 Replies
7. Shell Programming and Scripting
I have two files.
File 1 is a two-column index file, e.g.
comp11084_c0_seq6:130-468(-) comp12746_c0_seq3:140-478(+)
comp11084_c0_seq3:201-539(-) comp12746_c0_seq2:191-529(+)
File 2 is a sequence file with headers named with the same terms that populate file 1. ... (1 Reply)
Discussion started by: pathunkathunk
1 Replies
8. Shell Programming and Scripting
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 Replies)
Discussion started by: Ferocci
8 Replies
9. Shell Programming and Scripting
I have a file
file_name_O.txt
The file can have different number of other files names or nothing
I will check
cnt=`wc -l file_name_0.txt`
if ;then
exit 1
fi
Now I have to start checking file names, i.e. read txt file line by line. If amount of ,lines equal 1, I can... (4 Replies)
Discussion started by: digioleg54
4 Replies
10. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
LEARN ABOUT OPENSOLARIS
noecho
echo(3XCURSES) X/Open Curses Library Functions echo(3XCURSES)
NAME
echo, noecho - enable/disable terminal echo
SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib
-R /usr/xpg4/lib -lcurses [ library... ]
c89 [ flag... ] file... -lcurses [ library... ]
#include <curses.h>
int echo(void);
int noecho(void);
DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially,
curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft-
ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined.
RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR.
ERRORS
No errors are defined.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5)
SunOS 5.11 5 Jun 2002 echo(3XCURSES)