linux - grep from a input file, multiple lines while the input file has ^name -


i appreciate this:

i have huge file, give example of how formatted:

name:lastname:email 

i have input file lots of names set out example:

edward michael jenny 

i want match name column huge file name in input file, , if exact match (case insensitive)

once finds match want output .txt of matchs

i think can use command ^michael: give it.

can me grep problem?

sorry if not clear late , have been on problem ages

"centos 5, "grep -i -e -f file.txt /root/dir2search >out.txt"  file.txt containing ^michael: ^bobert: ^billy: 

doesn't find anything.

grep -i -e -f inputfile namesfile > outputfile want, if input file consists of 1 input name per line, in pattern suggested:

^michael: ^jane: ^tom: 

-i: case-insensitive matching

-e: regexp pattern matching (often default, don't know how environment set up)

-f: read patterns file, 1 pattern per line

>: redirect output file

to existing input file described (space-separated names) new format, use: sed -r 's/([^ ]+)[ $]?/^\1:\n/g;s/\n$//g' inputfile > newinputfile


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -