Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using grep within an alias

Status
Not open for further replies.

langford

Technical User
Aug 25, 2001
13
0
0
GB
Hello,

I have a file of contact numbers that I find I grep with great regularity. I have been trying to alias the command that I usually use
'$ more [filename] | grep [string]'
to a single charecter such as 'z' and enter the string to be grepped for after the aliased 'z'
$zDa If I were to look for Dave's contact details.

Have found lots on the alias and grep cmds but nothing on being able to link them. I am sure this must be possible but with little actual scripting exp am going round in circles, any help gratefully recieved.
 
Try this in KSH

$ alias z='more [filename] | grep'

then you can type

$ z [string]

Steve
 
Good afternoon Harris79,

Thank you for your help.

Regards
Langford
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top