Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
etc, it is so very close to being correct. i read elsewhere that paste -n would give me the skipped column rather than the shift but this is not in all version of paste. im reading on column, join, table, and just looking for what will do it.
What I am getting though from paste f1 f2 is disjointing
Can you define "disjointing" please?
Sorry but I don't manage in understanding your situation with the examples provided. It's not quite easy to get it just by the expected result. Could you try one of the following:
provide a more meaningful example with extracted actual content (if not confidential)?
provide the first 5 lines of 2 bogus files to "paste"?
Okay, it's clearer now.
Actually, your main issue is that the timeout doesn't return an "empty row" as you write it but no row at all. So I cannot imagine how shell could know that a line is missing so it goes on with the next one.
Either there is some logic between lines from file2 so you can indicate to shell when an expected line is missing OR you should try to write an empty row (or whatever default text you wish) in case of timeout. This done, you could paste your files as desired.
file 2 (some executed commands return empty row because operation times out and no way around this, in this example C is missing)
A
B
D
I need as output:
5 124124 A
20 93945 B
14 19009 blank (or string indicating command failed)
10 90413 D
paste -n is suppose to give me the blank space but this isn't in all shells.
How is any join technique going to know, in this example, whether the third row in file 2 is in fact the third row (with the fourth being missed out) or the fourth row (with the third being missed out)?
This is helpful thank you. I will use code tags in the future.
I will have to, ugh, put in more logic lol to make sure that there is something in the row to match the other rows.
Gosh this simple script got complicated fast. I guess that is pretty normal that dealing with something like this will double the size and complexity of the script.
People are correct, the paste command will not intelligently determine what lines to skip from file2. You'll have to figure out a way to match the file2 lines with file1 if you wish to use paste. The command description states this:
Quote:
Write lines consisting of the sequentially corresponding lines from each file
The key term is "sequentially corresponding lines"
EDIT: Sounds like you already got that point from the earlier posts.
This is helpful thank you. I will use code tags in the future.
I will have to, ugh, put in more logic lol to make sure that there is something in the row to match the other rows.
Gosh this simple script got complicated fast. I guess that is pretty normal that dealing with something like this will double the size and complexity of the script.
If file2 were to have a blank line (simply a LF) for each failed command rather than no line at all then that could work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.