Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hi Guys, need some assistance on the log file being created by my script. Please see below details:
[/code] Script:
#!/bin/bash
# Get the first value, which we will compare to the other
# values further down in the file.
STATIC=$(sed -n 4p POSData.log)
# Loop through the file to see if the STATIC value
# matches the other values VALUE
for i in $(seq -w 01 63); do
if grep -q "TID $i" POSData.log; then
VALUE=$(grep -A 3 "TID $i" POSData.log | tail -1)
if [ $STATIC == $VALUE ]; then
echo "Match."
else
echo "TID $i PLU Count ($VALUE ) is not matched with the Server Count ($STATIC )" >> PLUComp.log
fi
fi
done
============================
[/output] Source Log
LINUX SERVER
count
--------
331435
(1 row)
=======================
TID 01
count
--------
331435
(1 row)
=======================
TID 02
count
--------
331435
(1 row)
=======================
TID 03
count
--------
331439
(1 row)
=======================
TID 04
count
--------
331435
(1 row)
=======================
TID 05
count
--------
No Route To Host
(1 row)
=======================
TID 06
count
--------
331438
(1 row)
=======================
TID 07
count
--------
No Route To Host
(1 row)
=======================
TID 08
count
--------
No Route To Host
(1 row)
=======================
TID 09
count
--------
No Route To Host
(1 row)
=======================
[/output] Output Log
TID 03 PLU Count ( 331439 ) is not matched with the Server Count ( 331435 )
TID 05 PLU Count (No Route To Host ) is not matched with the Server Count ( 331435 )
TID 06 PLU Count ( 331438 ) is not matched with the Server Count ( 331435 )
TID 07 PLU Count (No Route To Host ) is not matched with the Server Count ( 331435 )
TID 08 PLU Count (No Route To Host ) is not matched with the Server Count ( 331435 )
TID 09 PLU Count (No Route To Host ) is not matched with the Server Count ( 331435 )
What I want to do is to reflect the following below in the logfile.
If client PC is online reflect this:
TID 03 PLU Count ( 331439 ) is not matched with the Server Count ( 331435 )
If the client PC is offline/cannot be reached, reflect this:
No Route To Host
I added additional condition in the script, but to no avail.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.