If you have a string "one two three", which shell command
would you use to extract the strings?
Answer Posted / narendrasairam
Though cut command works, if the string is too long you cant
expect redundancy in the code. So, better to translate the
spaces first and then reading the lines.
echo "enter the string :"
read string
echo $string | tr " " "\n" | sed '/^$/d' > lines.out
while read line
do
echo $line
done < lines.out
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.
What is the first line in a shell script?
Explain about the exit command?
What is shell and shell script?
What is a shell made of?
What is meant by $1 in shell script?
Explain about login shell?
What is the syntax of "nested if statement" in shell scripting?
What does it mean to debug a script?
What is ms powershell?
What is difference between shell and bash scripting?
Print the 10th line without using tail and head command.
What is the significance of the shebang line in shell scripting?
Explain about debugging?
How do you find out What is your shell?