Solved

retrieve nuemaric value from txt file in shell script

Posted on 2016-10-04
3
46 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 37

Expert Comment

by:Gerwin Jansen
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 37

Accepted Solution

by:
Gerwin Jansen earned 500 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now