The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Search flat file and return 3 fields
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Search flat file and return 3 fields
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
11-18-2008
yongitz
Registered User
Join Date: Apr 2008
Location: Philippines
Posts: 68
Code:
awk -F"," -v pat=$SERIALNUM '$0 ~ pat {print $2,$3}' your_flat_file.txt
This assumes that you only got one serial number stored in SERIALNUM variable.
yongitz
View Public Profile
Find all posts by yongitz
Find yongitz's past nominations received
Find yongitz's present nominations given