|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Command to find colums from the output
Hi
I want to know is there any command in Soalris which gives the number of columns for the output of any commnad. For example if I want to just check the number of columns from the generated output of uptime commnad, this must help me to find out.Of course we can check this from the man pages. But I am searching for a command. Thanks |
|
#2
|
|||
|
|||
|
There isn't a command that does this. You'll have to write a simple script.
For commands that return a bunch of lines you probably should try awk, this example will work for one-liners as well, but it's not efficient Code:
cols =`<command> | awk 'BEGIN {maxcol=0}
{ if (NF > maxcol)
{
maxcol=NF
}
} END {print maxcol} ' `
echo $cols
Last edited by jim mcnamara : December 20th, 2004 at 12:21 PM. Reason: didn't make it return number of columns |
|
#3
|
|||
|
|||
|
try: man wc
|
|
#4
|
|||
|
|||
|
Columns from a command
Hi Jim and guggach
Sorry for the late reply. I appreciate your help and it helped me a lot. Thanks |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Command to find colums from the output |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|