Skip to main content

All Questions

6 votes
4 answers
3k views

How to print multi-line variables in side-by-side columns in sh?

This question is based on a similar question on Ask Ubuntu, but instead of bash, I would like to have similar output in sh. No issue in bash; it works as expected. wolf@linux:~$ echo $SHELL /usr/bin/...
Wolf's user avatar
  • 1,731
2 votes
2 answers
3k views

Uniq based on last field, keeping last line, and append number of duplicates

I need some help to implement awk command in a bash script for implementing below logic. Tried sort/uniq combination, but no luck. I have a long list with time stamp and some number in front of it ...
Neeraj's user avatar
  • 53
1 vote
2 answers
891 views

Find value from array in one file, look up value in another file, and then use that value to find another and set as variable

So I have two files, file 1 looks like this: RR1.out RR2.out RR3.out RR4.out RR5.out RR6.out 45.7597 45.7646 45.4453 45.4448 45.2081 45....
Pyrodancer123's user avatar
3 votes
3 answers
3k views

How do I create uniform columns from text containing both tabs and spaces?

In the simplest form, let's say I have an auto-generated file called file.txt. The contents of file.txt appears as follows: Source Destination Maximum To Maximum ...
rubynorails's user avatar
  • 2,394
1 vote
1 answer
583 views

Comparing value in same column and directing output to new column

I have my input file as DPortal=ECCN RemoteFile=4004_130122 0256 A02 141111 0940 29343414 11 110005 DPortal=ECCN RemoteFile=4004_130122 0256 A02 141111 2336 29843714 11 110006 DPortal=ECCN ...
Ashwini Tyagi's user avatar
7 votes
3 answers
3k views

Print a multiline variable in a column

I have a script that collects values from a cluster. The values, in some cases, have multiple lines. I have a printf format that specifies how the data should be positioned however, it doesn't take ...
awreneau's user avatar
2 votes
2 answers
17k views

How to get the value from rows and columns from text file in bash?

I am working on a bash project. I need to get all the values (one at a time because I will be using them somewhere else) from a text file. The text file I will be getting is structured like this: ...
Redson's user avatar
  • 573
6 votes
6 answers
4k views

How to extract lines by words in specific position, not column?

I have an input file like this: v ATOM 57 O LYS A 7 2.254 25.484 18.942 1.00 14.46 ATOM 77 NH1AARG A 8 5.557 19.204 13.388 0.55 24.50 TER ...
Ooker's user avatar
  • 665