I have text as below in a file.
abcdxyz Time(0.010),blah blah blah
abcdxyz Time(1.010),blah blah blah
abcdxyz Time(0.010),blah blah blah
abcdxyz Time(2.010),blah blah blah
abcdxyz Time(3.010),blah blah blah
abcdxyz Time(8.010),blah blah blah
I want to grep all lines where value in Time()
is greater than 2.00
. How can I do this in ksh.
FYI: my OS is Red hat linux and I am using ksh
Try using awk
awk -F'[()]' '$2>2{print}' file
Output:
abcdxyz Time(2.010),blah blah blah
abcdxyz Time(3.010),blah blah blah
abcdxyz Time(8.010),blah blah blah
这有效(在AIX / ksh上)
sed 's/\(.*\)Time(\(.*\))\(.*\)/\2 \1Time(\2)\3/' a.dat | awk '{ if ($1 > 2.0) { $1="" ; print } }'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.