If you have a string "one two three", which shell command
would you use to extract the strings?
Answer Posted / swaroopa
Below methods will work. You could use either cut or awk
echo "read data"
read data
echo $data | cut -f1 -d" "
echo $data | cut -f2 -d" "
echo $data | cut -f3 -d" "
echo $data |awk -F" " '{print $1}'
echo $data |awk -F" " '{print $2}'
echo $data |awk -F" " '{print $3}'
Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.
What language is used in terminal?
What is an sh file?
Is shell scripting useful?
What happens when you type ls?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
What are different types of shell?
Why should we use shell scripts?
What is echo $shell?
What is a file basename?
What can scripts do?
What is shell prompt?
Explain about the exit command?
How will you connect to a database server from linux?
Is shell script a programming language?