The issue is, I'm looking for that blank, and there is usually only 1 or 2 missing information in the second(9) column but there are also page breaks of 2-3 blank lines. It always has a 2 digit number, or it is blank.
What I'm wanting is it to say
"searching for missing LD...."
and then output the missing only
54-23-
6-8-454
Hopefully I explained well enough
Last edited by shadowkraze; 07-22-2012 at 10:35 PM..
In future, having a sample of the input would really help.
This should eliminate file/and page:
THANK YOU!!! I understand, I put as much in as I could.. alot of the input is information I can't share so I had to simulate the output. Sorry. But that did what I wanted it to for now. Eventually I'm going to try and get it to take that first colomn and pull the employee it refers to. The first column is an emp ID. this file doesn't display the names of the employees, just some useless information to me and those two columns. from that step I have to go though and match it to an emp called by another script and I grep out the ID
for example his will output
6-8-454
I would then take this and do
tkemp | grep -a2 "6-8-454"
Which gives me
Name: YUNAS, XXXXX
ID: 6-8-454
I then know who I need to contact :-D
Hopefully I will get better at this and have this scripted and automated, so it only takes me a few minutes a day instead of an hour.
---------- Post updated 07-23-12 at 07:34 PM ---------- Previous update was 07-22-12 at 10:59 PM ----------
#
echo -e "--- Checking for missing Labor"
sleep 2
#This scans tkxtrn and looks for a missing LD and
#turns it into a variable only works if 1 is missing
LD=`tkxtrn | awk ' !(/File/ || /Page/) && NF > 2 && !$9 { printf( "%s \n", $5 ); }'`
if [ "${LD}" == "" ]; then
echo "No missing LD's found"
else
# This takes the ID of the missing emp and greps it from tkemp
echo "Please correct the missing LD for"
tkemp | grep -ia5 "${LD}"
fi
#------------------------------------------------
It works, and eliminated hours of paging through files!!
Now if I can learn enough to get it to output more than one.. sometimes there are 3 or 4 missing as this only works for one. I have a feeling this is going to be much more involved...
Last edited by shadowkraze; 07-23-2012 at 12:21 AM..
With a small adjustment to your script, it might work for multiple ones. I cannot test it, so I don't know if I've fat-fingered anything, but it's a start:
There might be a way to do it with just one execution of the 'tkxtrn' command, but without knowing a bit about the output I cannot say. I understand the need to not share sensitive info, so if you're willing to live with a bit of inefficiency, and this works, then go for it.
I pass a number to my script. Passing "1" below.
./getfile.sh 1
echo "User entered: $1"
ls -ltr *.conf | sed -n '$p'
I wish to use ls -ltr i.e list files in ascending order of time the latest showing at the bottom of the output.
Number 1 should get me the last row of ls -ltr output i.e... (9 Replies)
Hi everyone :)
I have a file "words.txt" containing hundreds of lines of text. Each line contains a slogan.
Using the code below i am able to generate an image with the slogan text from each line.
The image filename is saved matching the last word on each line.
Example:
Line 1: We do... (2 Replies)
i need to do something like this:
script.sh
#!/bin/sh
echo "hello"
echo "My First name is John"
echo "My Last name is Smith"
echo "I am here to save you a lot of work"
sed -n 4,5p $0
i dont want to run the script. i just want to pull out specific line from it. so the logic here... (5 Replies)
Sed command to replace a line in a file using line number from the output of a pipe.
Is it possible to replace a whole line piped from someother command into a file at paritcular line...
here is some basic execution flow..
the line number is 412
lineNo=412
Now i have a line... (1 Reply)
I am developing a script. This script takes in one parameter which is the name of a file whose content is a list of names of some files. The script can check whether those files exist in current directory.
Here is my question:
If the number of provided parameters is less than one or one of the... (2 Replies)
Dear Perl users,
I need your help to solve my problem below.
I want to print the sequence number without missing number within the range.
E.g. my sequence number :
1 2 3 4 5 6 7 8 11 12 13 14
my desired output:
1 -8 , 11-14
my code below but still problem with the result:
1 - 14
1 -... (2 Replies)
Hi,
I have one input file with the following content:
MY_inpfile.txt
Aname1 Cname1 Cname2 1808 5
Aname2 Cname1 1802 47
Bname1 ? 1819 22
Bname2 Cname1 1784 11
Bname3 1817 9
Zname1 Cname1 1805 59
Zname2 Cname1 Cname2 Cname3 1797 27
Every line in my input file have a 4 digit... (5 Replies)
I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like:
1 200.3 -0.3
2 201.7 -0.32
...
87 200.2 -0.314
I have another file which contains data that was taken at certain of these 87 positions. i.e.:
37 125
42 175
86 142
where the first... (1 Reply)
I`m having a output shown below,
CFR 235,BBC DM-2 ALL
CFR 111,BBC DM-2 ALL
CFR 333,BBC DM-2 ALL
from the above Output i want to use 235,111,333 as input for other purpose.
these no always change every time i run script.so please suggest me the way i could do it with example,i have tried... (5 Replies)
I need to insert the output of a script into a specific line number of a txt file.
I've read the Sed man page and searched the forums and it's not immediately clear how I would go about doing this. (4 Replies)