Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell Script to separate the colon from the given item

Posted By: Rainor Fischer     Category: Unix / Linux / Ubuntu     Views: 2899

Write a Shell Script to separate the colon from the given item.

Code for Shell Script to separate the colon from the given item in Unix / Linux / Ubuntu

echo "Enter the item separated by colons"
read col
i=1
while [ 1 ]
do
s=`echo $col | cut -d ":" -f $i`
if [ ! $s ]
then
exit
else
echo $s
i=`expr $i + 1`
fi
done

OUTPUT
***********
    [04MCA58@LINTEL 04MCA58]$ sh colon.sh
Enter the item separated by colons
abc:xyfds:sdfjek
abc
xyfds
sdfjek


  
Share: 


Didn't find what you were looking for? Find more on Shell Script to separate the colon from the given item Or get search suggestion and latest updates.

Rainor Fischer
Rainor Fischer author of Shell Script to separate the colon from the given item is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!