Skip to main content

All Questions

Tagged with
1 vote
3 answers
133 views

make master/slave ip in different subnet

For reference, this is a follow-up and variation on group ip address to different subnet with shell We have two strings (named master/slave), the two strings are composed with IPS spread in three ...
peng xiao's user avatar
-3 votes
2 answers
77 views

grep specified variable from a file [closed]

I have a variable like master='172.21.154.37 172.21.250.94 172.21.251.93 172.21.250.94' and I need to check whether the first and the second column in the file both matches the variable. The following ...
peng xiao'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
5 votes
5 answers
782 views

How can I replace multiple substrings from multiple lines in a file matching a pattern from a different file?

I have a file that contains multiple IP addresses and hostnames, and another file that contains some folders with many IP addresses per line. ip_hostname.txt host1 10.1.1.1 host2 10.2.2.2 host3 10.3.3....
Outsider's user avatar
0 votes
1 answer
927 views

Capturing hostname & data when executing local script on remote server

While trying to execute a local script on remotely host unable to get hostname of the remoteserver to a local output file. For example I am executing a script below. ssh remotehost sh -s < sudo su -...
AReddy's user avatar
  • 3,208
0 votes
4 answers
311 views

how to capture parameter and value from line

we want to capture only the parameter - segment.bytes and his value example echo "$info" | grep "segment.bytes" {"version":1,"config":{"segment.bytes":...
yael's user avatar
  • 13.9k
1 vote
2 answers
122 views

Editing the output of fslint with shell tools awk | grep | sed

The task is to transform this text file, output of the utility fslint, into a bash script with rm command lines for the duplicate file(s) to delete and commented lines for file(s) to keep, according ...
macxpat's user avatar
  • 29
-4 votes
2 answers
328 views

Create multiple random pairwise combination of words [closed]

File 1 contains the list of words that needed to be randomly paired Tiger Cat Fish Frog Dog Mouse Elephant Monkey File 2 contains the pairs that should not be used (in any solution) during random ...
Patel's user avatar
  • 5
4 votes
3 answers
2k views

How to add the real hostname in the beginning of Linux cli command [duplicate]

we have redhat servers - 7.2 the following output from sar print all relevant details as the following sar -p -d 1 1 07:16:35 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await ...
yael's user avatar
  • 13.9k
1 vote
1 answer
104 views

Computing pair-wise time differences in mili seconds between matching records in a data table

I have a three-column table of data of the following form: TIME MPID CPID 14:00:04.909 10048 370007 14:00:05.320 10048 370007 14:00:05.462 10048 370008 14:00:05.761 10048 370008 14:00:...
Vivek Nigam's user avatar
0 votes
2 answers
141 views

How to extract a range of number from two files?

I'm trying to extract the number range from two files. $ cat file1.txt chr1 69509 chr1 69511 chr1 71000 chr1 358112 chr1 586874 chr1 744200 . . . $cat file2.txt chr1 69091 70005 ...
user2905046's user avatar
0 votes
5 answers
810 views

How can I change the character of a string one by one?

I want to change all the characters in string one by one according to the substitution rule and save them to file on Linux. This is substitution file (sub.txt). A -> Y B -> V C -> Q ... ...
user2905046's user avatar
14 votes
3 answers
10k views

sum all numbers from "du"

We want to calculate the first numbers that we get from du du -b /tmp/* 6 /tmp/216c6f99-6671-4865-b8bc-7205f5388752_resources 668669 /tmp/hadoop7887078727316788325.tmp 6 /tmp/hadoop-hdfs ...
yael's user avatar
  • 13.9k
0 votes
1 answer
106 views

Looping 'find...-type f': Getting filenames by dir/subdir, ouputing a txt with name dir_subdir_fname.txt

My data structure is something like: dir1/subdir1_level1/subdir1_level2.../subdir1_leveln dir1/subdir2_level1/subdir2_level2.../subdir2_leveln ... Which means that the levels I'm working with are not ...
Faustino Delgado's user avatar
-1 votes
3 answers
1k views

how to remove the empty/blank lines from files that appears as @ from vi

when I open file by vi as vi file Current partition replica assignment @ @ @ @ @ {"version":1,"partitions":[{"topic")] @ @ @ @ @ Proposed partition reassignment configuration but I try to delete ...
yael's user avatar
  • 13.9k

15 30 50 per page