Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Parsing file using shell script

Avatar of vassim1977
vassim1977 asked on
Shell Scripting
1 Comment1 Solution394 ViewsLast Modified:
Hi i need a shell script to parse a file line by line .

//////////////////////////input file//////////////////////////
Service A Running :00
Service B Running :00
Service C Running :00
..
.
Total Running :00
///////////////////////////////////////////////////////

I need to read this file line by line saving each line into 2 variables var1 and var2
where var1 = "Service A Running and" var2 = ":00" please note second variable can be of format
":00" , "1:02" , "25:10" etc .. and first variable can consists from strings separated by withe spaces .

thats what i did so far is but stuck on parsing part and saving variables
/////////////////////////////////////////////////
cat inputfile | while read line;
do
 echo "$line"  ;
done
/////////////////////////////////////////////////

thaks in advance