All Questions
12 questions
26
votes
6
answers
10k
views
How can I sort a list with major.minor.patch level and sometimes rc correctly?
I have to sort the following list with a shell script and make the latest version appear on the bottom or top. How would I do that with shell tools only?
release-5.0.0.rc1
release-5.0.0.rc2
release-5....
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....
5
votes
4
answers
330
views
Incrementally Swap Lines Between Two Regex Patterns in a File
I'm trying to do some text processing on a file using a bash script. The goal is to take all of the lines starting with "field:" indented under an 'attribute:' label and swap them with the ...
5
votes
1
answer
746
views
The right tool to reverse the sorting order of thousands of elements in HTML file [closed]
I have a HTML file containing thousands of <div class='date'></div><ul>...</ul> blocks of code like below:
<!DOCTYPE html>
<html>
<head>
</head&...
2
votes
2
answers
186
views
counting occurences of pattern from an input file to match against a huge file
I have a list of colleges in a text file, and in a separate file I have a list of publications with affiliation. I want to write a script, to check, how many times a publication is repeated and to ...
1
vote
4
answers
941
views
Sort groups of rows where field values are the same in certain columns
I have a text file like this:
1 bob A
1 jim B
1 Kate A
1 Nancy C
1 bill A
1 Jason A
2 James B
2 fill B
2 cake C
2 lucky C
2 Lucy A
2 lily B
How can I order the data by column 3 within each 1 & 2 ...
1
vote
1
answer
109
views
Scripting for text processing: Delete a set of lines only if entire pattern matches
I want to delete a set of lines (globally) only if the entire pattern matches.
Pattern Description:
Line1:^[#]+ .*
Line2:^[[:space:]]*$
Line3:^-[[:space:]]*$
Line4:^[[:space:]]*$
Line5:^[#]+ .*$...
1
vote
1
answer
904
views
pattern file as an input to RS,FS in awk/sed/grep to recognize and add columns
I have a file which has the patterns that I have to find in the given data set and add the numbers in a columns of the data. I want to write a script or use awk/sed/grep to automatically query the ...
0
votes
1
answer
163
views
Pattern recognition and summing columns between two csv/excel files
I have two files, in which one has data on each person's start date, increment, promotion and other details, and the other file has their research output over the years. Can a script be written in ...
0
votes
2
answers
86
views
Data arrangement
I have data which i would like get output in below format using shell/perl script.
Data:
Virtual Machine Test status Running.
Assigned Server OVS001.local
Virtual Disk Test_DISK1 (30) size 61GB
...
-1
votes
1
answer
2k
views
Bulk replace multiple variables in multiple files at once
Example: I have 40 different variables like $VAR in 100 .txt files which are located in /home/user/EXAMPLE/. How do I replace all variables in the 100 files?
To tell the system what the variables are ...
-3
votes
1
answer
82
views
Comparing two fields from two files and printing the common items from the files with the count from each file
I have two files in a below-mentioned way
File1
Emp1 Dec10 12Am
Emp2 Dec10 2Am
Emp3 Dec10 4Am
Emp2 Dec10 6Am
Emp1 Dec10 8Am
File2
Emp1 Dec11 12Pm
Emp2 Dec11 2Am
Emp1 Dec11 3Am
Emp3 Dec11 ...