Skip to main content

All Questions

Tagged with
2 votes
3 answers
434 views

Replace prefix string from lines in a file, and put into a bash array

In the file groupAfiles.txt are the lines: file14 file2 file4 file9 I need a way to convert them to remove file and add /dev/loop and put them all in one line with a space between them. /dev/loop14 /...
user447274's user avatar
1 vote
6 answers
668 views

Bash script that takes multiple path arguments and checks if files can be successfully created there

I would like a bash shell script (for my Debian 12 system) which accepts multiple paths as arguments, and then checks if a file can be successfully created in each one. Then the result should be put ...
teeeeee's user avatar
  • 293
0 votes
2 answers
81 views

extract a column from the command output even if it blank bash

I am trying to extract 2nd column from a command output For example: $ sudo /usr/sbin/pvs PV VG Fmt Attr PSize PFree /dev/sdc1 vgswap lvm2 a-- 16.00g 0 /dev/sdc2 ...
Vija200's user avatar
4 votes
3 answers
552 views

Two ssh output as awk input

I have two remote servers that I am trying to ssh and cat some files.. I want to input the output of the ssh to a awk command. This is what I have got ssh username@host1 “cat /tmp/test/*” ssh ...
NecroCoder's user avatar
1 vote
2 answers
221 views

identify content inside base64 encoded content and replace the whole line

I have a script that outputs some information on my shell, like this: field1: value1 field2: value2 ... fieldn: valuen one such field/value can be: CmdLine: C:\Windows\System32\WindowsPowershell\...
João Ciocca's user avatar
-1 votes
3 answers
168 views

Replace new lines at end for those lines whose 2nd field in colon separated file span over to multiple line

I have got multiple files with different set of contents but the pattern is same across mulitple lines in different files. sample input file : cat -n test.txt 1 adjfkhjdhfkjd: ...
Ashis Sahoo's user avatar
0 votes
1 answer
310 views

compare 2 csv files using specific column and ignore specific string

My OS: RHEL7.X I've a csv file with 3 columns, like so - #######Category: Fruit Berries are fruit,04415bef-8c82-4672-848a-9ac80035040a,"Blah/Blah And/More/Blah" Apple is a fruit,073c6bf3-...
Raman Kathpalia's user avatar
0 votes
1 answer
173 views

How do I append an output to existing rows?

I'm running a command that outputs a list of numbers. I am using a for loop to run the command 5 times. For each output, I want to append those numbers to corresponding rows in an existing text file. ...
ttttttt's user avatar
0 votes
1 answer
147 views

Permutation with bash - Spread Five over Eight

Assuming I have the values A B C D E and eight places 1 2 3 4 5 6 7 8. How can I get all possible combinations printed with two- and three-time repetitions? Example: 1 2 3 4 5 6 7 8 _______________ A ...
nath's user avatar
  • 6,074
1 vote
3 answers
1k views

Cumulative sum of a column of a multicolumn file and save the entire file

How to compute cumulative sum of a column in a multicolumn file and save the entire file using bash command? An example of input file is below: 0 1869.75 31 1.342 1869.75 31 9.8 2479.45 ...
Atikul Haque Farazi's user avatar
0 votes
0 answers
28 views

AWK: field separator as '\x01' [duplicate]

I have a File with below content like below 123\x01abc\x01bcd\x01\123 I tried using below two commands in bash: echo "123\x01abc\x01bcd\x01\123" | awk -F'\\x01' '{print $1}' echo &...
Ramkrushna26's user avatar
0 votes
1 answer
79 views

Convert multiple rows into one rows in a delimiter txt file [duplicate]

I have input file like below ID~NAME~CREATED_DATE~NOTES~LAST_MODIFIED_DATE "12345"~"abc"~"9/7/2022 10:05:18 AM"~"new patiant"~"9/7/2022 11:52:18 AM" &...
s v's user avatar
  • 27
0 votes
1 answer
59 views

I want remove repeated records and remove those lines in awk

I want check repeated records in column 2 and remove those lines in awk create a delete a create b create c delete c create d delete f create f create g create h Expected Output create b create d ...
Nabob's user avatar
  • 15
3 votes
2 answers
194 views

Using awk to align values in correct rows in csv files

This was a question coming from here Aligning values in csv file The problem is that I would like to align the values on the 5th column based on how they match with the first column. Input: "DB ...
Gifter Villanueva's user avatar
2 votes
2 answers
892 views

Applying function to first column and inserting it as second

So I have been searching like crazy, but I still have not found a satisfactory solution. I have some output which looks like the following kdeconnec 1625 1000 11u IPv6 414426 0t0 UDP *:...
N3buchadnezzar's user avatar

15 30 50 per page
1
2 3 4 5
16