[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using terminal output as input



In <[🔎] 880dece00905170250o422275adv83039d8ece7282bb@mail.gmail.com>, Dotan 
Cohen wrote:
>2009/5/14 Boyd Stephen Smith Jr. <bss@iguanasuicide.net>:
>> These are particularly useful when combined with the "UNIX filter
>> commands" tr, grep, sed, cut, paste, and awk plus the tee command.
>
>I am baffled that one must type in the output to commands. For
>instance, the sysadmin may need to use the existing DHCP IP address
>for one reason or another. After running ifconfig, where the address
>is stated, why must he type it in? I'm not looking for copy-paste in
>the GUI sense, but some sort of this-to-there method for carrying
>small bits of data seems so useful, basic, and would help prevent
>typos.

Something like this?:
$ /sbin/ifconfig wlan0 | awk -F'[: ]*' '/inet[^6]/ { print $4 }'
10.0.0.101

awk, sed, grep, etc. are how you filter the output down to exactly what you 
need via pipes.  Pipes or variables are how to get information into the 
commands that could use it as input.

Your this-is-there method is the use of awk, grep, sed, etc.
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: