Skip to main content

All Questions

Tagged with
1 vote
4 answers
234 views

swap matched columns

I have an awk issue need your help,I just need to grep on the second column and if matched,swap the second column with the first column. 172.21.154.40 172.21.254.25 172.21.250.94 172.21.154.37 172.21....
peng xiao'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
-2 votes
1 answer
67 views

regular single column data to multiple rows

source data KKK-SNMImsi: 444444 KKK-SNMUserProfileId: KKK-SNMDefaultAutomaticProfile KKK-SNMMmeAddress: TDSGSN01 KKK-SNMMsisdn: 44235682436 KKK-SNMLocationState: LOCATED KKK-SNMRoamingAllowed: FALSE ...
Peter Cherop'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
0 votes
3 answers
375 views

Extract UTC time and find difference

I have a file with the following sample records for buy and sell events Buy at time=Thu Aug 03 2023 14:13:08 GMT+0200 (Central European Summer Time) Sell-at time=Thu Aug 03 2023 14:53:02 GMT+0200 (...
user3696623'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
112 views

How to create a sh script that can give as output the exact string I want using the awk command [duplicate]

I would like to have some help writing a script (which should work on FreeBSD where I have sh as default) that should grab a precise string when I do a ps ax | grep bhyve command from the terminal. ...
Marietto's user avatar
  • 579
0 votes
0 answers
17 views

How to returns the correct character after manipulating the output of ps ax | grep [duplicate]

I would like to have some help writing a script (which should works on freebsd where I have sh as default) that should grab a precise character when I do a "ps ax | grep" command from the ...
Marietto's user avatar
  • 579
0 votes
2 answers
2k views

Merge all csv files in directory column wise

Say the directory contained 3 csv files: The first csv: Name, John Age, 18 The second csv: Name, Jim Age, 21 The third csv: Name, Amy Age, 22 I would want the result to be: Name, John, Jim, Amy Age,...
Tap's user avatar
  • 35
4 votes
5 answers
651 views

Manipulating text using shell script: How can I fill in "missing" lines?

I have a list of data, like a CSV but some lines are missing a value. I'd like to generate a value for the missing line based on the lines before and after using linux shell script. Take this table ...
Darius Dauer's user avatar
0 votes
1 answer
305 views

Concatenate Columns and Create a Composite Key from a Text File in Shell Script

I have been trying to implement a Feature in my Shell Script but somehow stuck in implementation, need help please. Sample File - f1.txt col1|col2|col3|rev|spt A1|54|tyre|56.89|45.23 B1|54|pole|11.89|...
Samrat Saha's user avatar
1 vote
1 answer
208 views

Shell process substring

I know I can replace a substring with sed and integrate command evaluation with $(...). But what if I want the replacement to be calculated from the string to be replaced? Example I have a formatted ...
xeruf's user avatar
  • 621
2 votes
2 answers
526 views

AWK Command Argument Error

I have a dataset which contains contact information of students, the sample data set is as follows First Name, Last Name, Address, Phone Number John, Doe, "House # 11, Street xyz, Road, Area"...
Mr. Underscore's user avatar
0 votes
1 answer
356 views

awk prints if and else case

I wrote the following command: lsblk -nl /dev/sdd -o MOUNTPOINT | awk '{if (NR!=1 && $1) { print 1; } else { print 0; }}' It is supposed to check if any of the paritions of the given device, ...
Kyu96's user avatar
  • 183
0 votes
3 answers
9k views

Shell script to find the list of a keys inside a key in Yaml file

I have a yaml file info: description: Api contact: name: Api tags: - name: "" description: "" paths: /data1/1: post: tags: - "tag1" /...
Prashanth Sams's user avatar

15 30 50 per page
1
2 3 4 5
7