Search Results

Search: Posts Made By: chirish
1,532
Posted By chirish
duh.. >>> f = open('book.txt', 'r') >>>...
duh..


>>> f = open('book.txt', 'r')
>>> text = f.read()
>>> f.close()
>>> m = re.findall(r'(book\d).+?price\s(\d+)', text, re.DOTALL)
>>> m
[('book1', '23'), ('book2', '22'), ('book3',...
1,532
Posted By chirish
regular expression grouping across multiple lines
cat book.txt

book1 price 23
sku 1234
auth Bill
book2 sku 1233
price 22
auth John
book3 auth Frank
price 24
book4 price 25
sku 129
auth ...
4,449
Posted By chirish
fuzzy sequence match in a text file
Hi Forum:

I have struggle with it and decide to use my eye ball to accomplish this.

Basically I am looking for sequence of date inside a file.
If one of the sequence repeat 2-3 time or skip...
2,288
Posted By chirish
Thanks!! That work great. awk...
Thanks!! That work great.
awk '$2>M[$1]{M[$1]=$2}END{for (i in M) print i,M[i]}' file

I will go RTFM on Awk :) but would love to be taught how to fish instead of given say fish :)

Put the 2nd...
16,530
Posted By chirish
This should help? ls -l | egrep -e...
This should help?

ls -l | egrep -e "*.log[1,2]$|*.log$"

--
David
2,288
Posted By chirish
Only print the entries with the highest number?
Just want to say this is great resources for all thing Unix!!

cat tmp.txt
A 3
C 19
A 2
B 5
A 1
A 0
C 13
B 9
C 1

Desired output:

A 3
B 9
C 19

The following work but I am...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 04:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy