Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

retrieve nuemaric value from txt file in shell script

Posted on 2016-10-04
3
Medium Priority
?
125 Views
Last Modified: 2016-10-05
below content has been written in a text file called test.txt. How to retrieve pending  & completed count value in shell script?

<p class="pending">Count: 0</p>
<p class="success">Count: 0</p>
<p class="completed">Jobs completed today: 0</p>

#!/bin/bash

echo
echo 'Fetching job page and write to ZipJobs.txt file...'
curl -o Jobs.txt https://cms.test.com/test

status=`grep "Jobs completed today" /home/Jobs.txt | ???
echo $status
0
Comment
Question by:chaitu chaitu
  • 2
3 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 41828205
cut -d":" -f2 | cut -d"<" -f1`
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 41829257
Gerwin,

can you please expalin what is cut command & f2 & f1??
0
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 2000 total points
ID: 41829298
cut is cutting text into pieces, with -d you set the separator and with -f you select the field(s) to print.  put the above in place of your???
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month12 days, 20 hours left to enroll

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question