10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Data file example
I look for primary and * to isolate the interesting slot number.
slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'`
Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies
2. Shell Programming and Scripting
Hi,
I wanted to grep string "ERROR" and "WORNING" after last occurrence of String "Starting" only and wanted to display two lines after searched ERROR and WORNING string and one line before. I have following cronjob log file "errorlog" file and I have written the code for same in Unix as below... (17 Replies)
Discussion started by: nes
17 Replies
3. Shell Programming and Scripting
I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported
Input file is a free flowing file without any format
example of output
ERR-00001=5
....
ERR-01010=10
.....
ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies
4. Shell Programming and Scripting
Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows.
header for file
1111
2222
3333
header for file
1111
2222
3333
header for file... (8 Replies)
Discussion started by: gary_w
8 Replies
5. Shell Programming and Scripting
I have the following code:
declare -a search
search=(name label elapsed totalfilecount totalfilebytes starttime exitcode errors warnings fatals)
for (( i = 0 ; i < ${#search} ; i++ ))
do
data=`awk -F '^'${search}'=\"' 'BEGIN{RS="\" "; OFS="\n"; ORS=""} { print $2 }' summary.alg`
... (1 Reply)
Discussion started by: Ikon
1 Replies
6. Shell Programming and Scripting
Hi,
I'm trying to match records using awk which contain only one occurance of my string, I know how to match one or more (+) but matching only one is eluding me without developing some convoluted bit of code. I was hoping there would be some simple pattern matching thing similar to '+' but... (9 Replies)
Discussion started by: jonathanm
9 Replies
7. UNIX for Dummies Questions & Answers
There is scenario that i have to replace a pattern at the first 5 occurance in a file. say i need to replace 'abc' by 'xyz' at its first 5 occurance in a file a.txt,
can anybody help me how it can be done, i can do complete replacement of the pattern using sed throughtout the file. (1 Reply)
Discussion started by: palash2k
1 Replies
8. Shell Programming and Scripting
Hello Everyone,
Please help me in finding out the solution.
The problem is .. lets say i have 600 files in a directory. All 600 files are shell script files. Now i need to find out the files which contains a pattern "SHELL" more than once.
No matter how the pattern occurs , it can be in... (10 Replies)
Discussion started by: Prahlad
10 Replies
9. Shell Programming and Scripting
Hi,
I have two files viz,
rak1:
$ cat rak1
rak2:
$ cat rak2
sdiff rak1 rak2 returns:
I want the lines that got modified, changed, or deleted preceding with the section they are in.
I have done this so far: (1 Reply)
Discussion started by: rakeshou
1 Replies
10. UNIX for Dummies Questions & Answers
In a file a pattern is occured many times randomly. Even it may appear more then once in the same line too. How i can get the number of times that pattern appeared in the file? let the file name is abc.txt and the pattern is "xyz".
I used the following code:
grep -ic "xyz" abc.txt
but it is... (3 Replies)
Discussion started by: palash2k
3 Replies