10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello to all,
How would be the correct regex to match only the first occurence of
the pattern 3.*6.
I'm trying with 3.*6 trying to match only 34rrte56, but with my current regex is matching 4rrte567890123456789123powiluur56. And if I try with ?
doesn't print anything
echo... (6 Replies)
Discussion started by: Ophiuchus
6 Replies
2. Shell Programming and Scripting
I have a file
# cat asasas
AAAAAA
11
22
33
44
BBBBB
NILNILNIL
AAAAAA
22
33
44
55
66
77
88
BBBBB
NILNILNIL (2 Replies)
Discussion started by: anil510
2 Replies
3. Shell Programming and Scripting
Dear all,
I have data like below and i need to add coloumn before the COUNT field to see the Percentage out of all COUNT field value for respective raw.
=============================================
COUNT CODE sConnType tConnType... (6 Replies)
Discussion started by: Iroshan
6 Replies
4. Shell Programming and Scripting
I have a text file:
firstname: John
lastname: Jay
age: 33
firstname: Amy
lastname: Jay
age: 12
firstname: Max
lastname: Jay
age: 50
Currently I have
first=`grep firstname file.txt | head -1`
age=`grep -A 2 $name file.txt | tail -1` (7 Replies)
Discussion started by: etranman1
7 Replies
5. UNIX for Dummies Questions & Answers
Hi guys!
I need to count the occurence of a certain pattern.
For example the pattern is PC.
the contents of the file sample.txt:
A PC
asdfgadfjkl
asdfa PC sadfaf
fdsPCasdfg
if i use grep -c PC sample.txt
it will display 3 as the number of occurence
how do i save that number to a... (1 Reply)
Discussion started by: khestoi
1 Replies
6. UNIX for Dummies Questions & Answers
File1.txt
.......
.......
OMC LA
OMC LK
OMC LS
........
........
Above is the content of File1.txt, i want to get the Number of Occurence to order, lets say if OMC LA = 1, OMC LS=3, and OMC LK=2..
omc_ident="OMC LA" or "OMC LK" or "OMC LS"
omc_num=`grep '^OMC' File1.txt| grep... (4 Replies)
Discussion started by: neruppu
4 Replies
7. Shell Programming and Scripting
Hi All,
Is there any awk or unix command that i can make use such that the output will be as desired ?
The code will extract the latest pattern starting from the term above the asterix till the end of the input
Input:
********
aaa bbb 2007
********
123
234
134
********
xxx yyy 2007... (9 Replies)
Discussion started by: Raynon
9 Replies
8. UNIX for Advanced & Expert Users
Hi,
This is the format of the file that i have
StartDate:10/01/06
EndDate :10/02/06
Cno Ccode
1 10
2 11
StartDate:10/03/06
EndDate :10/04/06
Cno Ccode
2 13
4 12
StartDate:10/01/06
EndDate :10/02/06 (5 Replies)
Discussion started by: kkm_job
5 Replies
9. UNIX for Dummies Questions & Answers
is there a grep or awk one-line command to print the line of the last occurence of a string in a file? (3 Replies)
Discussion started by: apalex
3 Replies
10. UNIX for Dummies Questions & Answers
I am using grep to pull out info from a file.
The line I am searching for begins:
START TIME - Tue Sep 11 16:40:00.
There are mutiple lines of START TIME. I need the FIRST occurence ONLY.
My grep is as follows:
start="$( grep 'START TIME' filename | cut -c15-33)"
If I echo or cat... (2 Replies)
Discussion started by: app4dxh
2 Replies