cola
1
n2=user1 pts/3 2010-06-29 01
Now i want to split this string with space(' ') character.
After splitting output would be:
use1
pts/3
2010-06-29
01
I did:
nn=${n2} | cut -d ' ' -f2
echo ${nn}
It prints nothing.
I want the output:
pts/3
Where is the problem?
zaxxon
2
n2=user1 pts/3 2010-06-29 01
This will not work, surround it with double brackets.
nn=${n2} | cut -d ' ' -f2
There is a missing echo in front of $ and either backticks in front of the commands and at the end or $().
Should look like:
$> n2="user1 pts/3 2010-06-29 01"
$> nn=`echo ${n2} | cut -d ' ' -f2`
$> echo $nn
pts/3
Try to assign n2 in double quotes..
n2="user2 pts..."