Print Line as per the dependent sequence in shell script.
Hi i have a file like this as shown below:
Code:
DA PROCESS_ID IDENTIFIER DA_FILE STATUS WAITING_FOR SCOPED_DEPENDENT
1836 21000 01052019 BH90P.TEMP.DA1836.FTP W NULL S
1836 22000 01052019 BH90P.TEMP.DA1836.FTP W 1836/21000 S
1836 23000 01052019 BH90P.TEMP.DA1836.FTP W 1836/22000 S
1836 24000 01052019 BH90P.TEMP.DA1836.FTP W 1836/23000 S
1836 25000 01052019 BH90P.TEMP.DA1836.FTP W 1836/24000;1801/24000;2248/24000 S
1836 26000 01052019 BH90P.TEMP.DA1836.FTP W 1836/25000 S
1836 27000 01052019 BH90P.TEMP.DA1836.FTP W 1836/26000 S
1836 ETL31 01052019 BH90P.TEMP.DA1836.FTP W 1836/27000 S
1836 ETL32 01052019 BH90P.TEMP.DA1836.FTP W 1836/ETL31 S
1836 ETL33 01052019 BH90P.TEMP.DA1836.FTP W 1836/ETL32 S
2120 24000 01052019 BH90P.* W 1801/ETL33;1836/ETL33;2248/ETL33 D
2120 25000 01052019 BH90P.* W 2120/24000 D
2207 24000 01052019 BH90P.NORDEASE.DA2207.FTP W 2120/25000 D
2207 25000 01052019 BH90P.NORDEASE.DA2207.FTP W 2207/24000;2208/24000;2209/24000 D
2208 24000 01052019 BH90P.NORDEASE.DA2208.FTP W 2120/25000 D
2208 25000 01052019 BH90P.NORDEASE.DA2208.FTP W 2208/24000 D
2209 24000 01052019 BH90P.NORDEASE.DA2209.FTP W 2120/25000 D
2209 25000 01052019 BH90P.NORDEASE.DA2209.FTP W 2209/24000 D
2248 24000 01052019 BH90P.NORDEAFI.DA2248.FTP W 1836/24000 D
2248 25000 01052019 BH90P.NORDEAFI.DA2248.FTP W 2248/24000 D
2248 26000 01052019 BH90P.NORDEAFI.DA2248.FTP W 2248/25000 D
2248 27000 01052019 BH90P.NORDEAFI.DA2248.FTP W 2248/26000 D
2248 ETL31 01052019 BH90P.NORDEAFI.DA2248.FTP W 2248/27000 D
2248 ETL32 01052019 BH90P.NORDEAFI.DA2248.FTP W 2248/ETL31 D
2248 ETL33 01052019 BH90P.NORDEAFI.DA2248.FTP W 2248/ETL32 D
1577 ETL31 01052019 BH90P.NORDEAFI.DA1577.FTP W 1592/27000;1596/27000;1836/27000 D
1577 ETL32 01052019 BH90P.NORDEAFI.DA1577.FTP W 1577/ETL31 D
1577 ETL33 01052019 BH90P.NORDEAFI.DA1577.FTP W 1577/ETL32 D
1588 ETL31 01052019 BH90P.NORDEAFI.DA1588.FTP W 1592/27000;1596/27000;1836/27000 D
1588 ETL32 01052019 BH90P.NORDEAFI.DA1588.FTP W 1588/ETL31 D
1588 ETL33 01052019 BH90P.NORDEAFI.DA1588.FTP W 1588/ETL32 D
1590 24000 01052019 BH90P.NORDEAFI.DA1590.FTP W 1836/23000 D
1590 25000 01052019 BH90P.NORDEAFI.DA1590.FTP W 1590/24000 D
1590 26000 01052019 BH90P.NORDEAFI.DA1590.FTP W 1590/25000 D
1590 27000 01052019 BH90P.NORDEAFI.DA1590.FTP W 1590/26000 D
1590 ETL31 01052019 BH90P.NORDEAFI.DA1590.FTP W 1590/27000 D
1590 ETL32 01052019 BH90P.NORDEAFI.DA1590.FTP W 1590/ETL31 D
1590 ETL33 01052019 BH90P.NORDEAFI.DA1590.FTP W 1590/ETL32 D
1592 24000 01052019 BH90P.NORDEAFI.DA1592.FTP W 1836/23000 D
1592 25000 01052019 BH90P.NORDEAFI.DA1592.FTP W 1592/24000 D
1592 26000 01052019 BH90P.NORDEAFI.DA1592.FTP W 1592/25000 D
1592 27000 01052019 BH90P.NORDEAFI.DA1592.FTP W 1592/26000 D
1592 ETL31 01052019 BH90P.NORDEAFI.DA1592.FTP W 1592/27000 D
1592 ETL32 01052019 BH90P.NORDEAFI.DA1592.FTP W 1592/ETL31 D
1592 ETL33 01052019 BH90P.NORDEAFI.DA1592.FTP W 1592/ETL32 D
1596 24000 01052019 BH90P.NORDEAFI.DA1596.FTP W 1836/23000 D
1596 25000 01052019 BH90P.NORDEAFI.DA1596.FTP W 1596/24000 D
1596 26000 01052019 BH90P.NORDEAFI.DA1596.FTP W 1596/25000 D
1596 27000 01052019 BH90P.NORDEAFI.DA1596.FTP W 1596/26000 D
1596 ETL31 01052019 BH90P.NORDEAFI.DA1596.FTP W 1596/27000 D
1596 ETL32 01052019 BH90P.NORDEAFI.DA1596.FTP W 1596/ETL31 D
1596 ETL33 01052019 BH90P.NORDEAFI.DA1596.FTP W 1596/ETL32 D
1598 24000 01052019 BH90P.NORDEAFI.DA1598.FTP W 1836/23000 D
1598 25000 01052019 BH90P.NORDEAFI.DA1598.FTP W 1598/24000 D
1598 26000 01052019 BH90P.NORDEAFI.DA1598.FTP W 1598/25000 D
1598 27000 01052019 BH90P.NORDEAFI.DA1598.FTP W 1598/26000 D
1598 ETL31 01052019 BH90P.NORDEAFI.DA1598.FTP W 1598/27000 D
1598 ETL32 01052019 BH90P.NORDEAFI.DA1598.FTP W 1598/ETL31 D
1598 ETL33 01052019 BH90P.NORDEAFI.DA1598.FTP W 1598/ETL32 D
1801 24000 01052019 BH90P.NORDEASE.DA1801.FTP W 1836/24000 D
1801 25000 01052019 BH90P.NORDEASE.DA1801.FTP W 1801/24000 D
1801 26000 01052019 BH90P.NORDEASE.DA1801.FTP W 1801/25000 D
1801 27000 01052019 BH90P.NORDEASE.DA1801.FTP W 1801/26000 D
1801 ETL31 01052019 BH90P.NORDEASE.DA1801.FTP W 1801/27000 D
1801 ETL32 01052019 BH90P.NORDEASE.DA1801.FTP W 1801/ETL31 D
1801 ETL33 01052019 BH90P.NORDEASE.DA1801.FTP W 1801/ETL32 D
In this file Column 6 contains dependencies values , i want to read file line by line and Print each line if its dependencies is already printed.
for example if dependency i s then we can print line no 1 having PID - 21000 , similarly of PID-24000 if Dependency 1836/23000 is printed then only it can proceed to print.
How can i achieve the same using shell script because there are few cases where multiple dependecies are available like for PID-25000
1836/24000;1801/24000;2248/24000
Can any one help me with shell script achieve the same.
Moderator's Comments:
Please wrap your samples/codes into CODE TAGS as per forum rules.
Last edited by RavinderSingh13; 06-07-2019 at 09:23 AM..
Dear People,
My query is:
have a file, which looks likes this:
10 20 30 40 50
1 2 3 4 5
100 200 300 400 500
what i need is: "PRINT EACH LINE TO AN UNIQUE FILE"
desired output:
file 1
10 20 30 40 50
file 2
1 2 3 4 5 (3 Replies)
Hi,
I want to print the line number with the pattern of the line on a same line using multi-patterns in sed.
But i don't know how to do it.
For example, I have a file
abc
def
ghi
I want to print
1 abc
2 def
3 ghi
I know how to write it one line code, but i don't know how to put... (11 Replies)
Korn Shell in AIX 6.1
I want to print the below shown pipe (|) separated list line by line.
line=es349889|nhb882309|ts00293|snh03524|bg578835|bg37900|rnh00297|py882201|sg175883
for i in line
do
echo "Hello $line "
done
I wanted to execute the above for loop. But i can't even set the... (3 Replies)
Hello Folks,
i have to write shell scripting for given expected output manner.
in given input we have to write shell script in such a way that sequence no can b merged/link between start and end digit with hyphen "-" symbol and rest of digit separated by ","
Eg :
For Input "2 6 7 8 11 12... (9 Replies)
Hello all,
I have several directories with a sequence of files like this
IM-0001-0001.dcm
IM-0001-0002.dcm
IM-0001-0003.dcm
IM-0001-0004.dcm
IM-0001-0005.dcm
I would like to print out the name of the file that is missing.
I currently have the following ineffecient way to do this... (4 Replies)
Dear All members,
i have some trouble here, i want to ask your help. The case is:
I have some data, it's like:
-ABCD1234
-ABCD1235
-ABCD1237
-BCDE1111
-BCDE1112
-BCDE1114
there is some missing data's sequence (the format is: ABCD = name 1234 = sequence).
I want to print the... (2 Replies)
Hi all,
From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30.
Input would be like ...
AN237 010 193019 0502 1 CSU Amoxycillin
AN237 080 ... (2 Replies)
Hi Friends,
I have a series of alphabets like this
AGCAA
The values inside the square brace indicate that either of them can be present at that position. And those ones without a brace, means that they are the only ones that could be printed at that location.
Now, I would like to know... (5 Replies)
I have a shell script scheduled in cron job to run at every 1 minute which transfers files to remote machine and then move the files to backup folder.
cd /u01/app/ftp_tmp
sftp user@hostname <<-EOF
cd /home/user/ftp
mput *
bye
EOF
mv /u01/app/ftp_tmp/* /u01/app/ftp_bkp
Now the problem is... (6 Replies)
I have multiple jobs and each job dependent on other job.
Each Job generates a log and If job completed successfully log file end's with JOB ENDED SUCCESSFULLY message and if it failed then it will end with JOB ENDED with FAILURE.
I need an help how to start.
Attaching the JOB dependency... (3 Replies)