Whats the syntax for 'cut' in following?


 
Thread Tools Search this Thread
Operating Systems Solaris Whats the syntax for 'cut' in following?
# 8  
Old 05-29-2009
MySQL

Code:
ifconfig -a | sed -n '/BROADCAST/ s/: .*$//p'

Thanks for this.It works too.

Any idea on how the same o/p would be achived in SUSE Linux?
# 9  
Old 05-29-2009
I have currently no SuSE or other Linux box available.

What does its "ifconfig -a" output looks like when virtual interfaces are present ?
# 10  
Old 05-29-2009
Linux uses 'eth[0-9]' instead of driver names. So...

ifconfig|grep -e "^eth[0-9]"|awk '{print $1}'
# 11  
Old 05-29-2009
Quote:
Originally Posted by seg
Linux uses 'eth[0-9]' instead of driver names. So...

ifconfig|grep -e "^eth[0-9]"|awk '{print $1}'
why using 'grep' AND 'awk'....
Code:
ifconfig| awk '/^eth[0-9]/ {print $1}'

# 12  
Old 05-29-2009
Quote:
Originally Posted by vgersh99
why using 'grep' AND 'awk'....
Code:
ifconfig| awk '/^eth[0-9]/ {print $1}'

Ah, cool- I did not know it could be done like that!
# 13  
Old 06-01-2009
MySQL

thanks guys

both things work...

one small change for linux is

Code:
/sbin/ifconfig| awk '/^eth[0-9]/ {print $1}'


now on my solaris box ,i wrote following to get MAC address

Code:
arp -a | grep "<hostname>" | grep "<interface_name>" | head -1 | awk '{print $5}'

i get data pertaining to physical interfaces as 'arp' returns only those.

i need to see if i can write something like this:

say there are two logical interfces 'ceo:1','ce0:2',then it should bear same MAC address as that of 'ce0'.

any code suggestion is welcome !!

Regards
Abhi
# 14  
Old 06-03-2009
MySQL

gotcha !!!
quite a simple line of code...

thanks everyone !!
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using :<<cut / cut to comment out block of bash script

I am using : << cut / cut to comment out block of code. Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines. The "warning " is at last line of script. done < results 169 echo "END read all positioning parameters" 170... (8 Replies)
Discussion started by: annacreek
8 Replies

2. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies

3. Shell Programming and Scripting

Function works, trigger causes syntax error, whats my fault??

Needing a hint. Creating that function called Meter my simple script works well. What I want now is to start the last four commented lines to include or trigger a reaction, if there are more than n lines in that .txt-file it shall display that message for example. But the interpreter says there is... (3 Replies)
Discussion started by: 1in10
3 Replies

4. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

5. Shell Programming and Scripting

Whats wrong with the syntax

Whats wrong with below logic or syntax???? (4 Replies)
Discussion started by: dsravan
4 Replies
Login or Register to Ask a Question