Skip to main content

All Questions

Tagged with
0 votes
1 answer
68 views

AWK replace some special new line to one line

i have some log like this: 2023-11-15T08:59:28.000000+00:00 database-1 # Time: 231115 8:59:28 # User@Host: rdsadmin[rdsadmin] @ localhost [] # Thread_id: 3 Schema: QC_hit: No # Query_time: 0....
dvthanh's user avatar
0 votes
1 answer
54 views

Linux - Find string and then end of section

I have an XMLTV file. I need to get all of the programme sections for a specific channel. An example snippet: <programme start="2023031305000 -0400" end="2023031305300 -0400&...
Dan Marcoux's user avatar
1 vote
1 answer
400 views

How to find the "pattern" in FASTA file and record the cordinates along with header

I am looking for a solution to search for a string of 17 base pairs in the FASTA file that is the human reference genome. To clarify, in simple words and put the resources, i have tried grep function ...
Santosh's user avatar
  • 13
2 votes
2 answers
126 views

Find and delete near duplicate lines with certain punctuation

I have a text file with millions of lines. Some lines contain the same alphanumeric sequence, but differ in case and punctuation. I consider these lines duplicates. I want to remove any duplicate line ...
Priora's user avatar
  • 35
0 votes
2 answers
643 views

Remove the file name from a messy path in a text file awk or sed

I have an xml file with many lines containing something like this: Save="C:\Users\Administrator\Desktop\my files\1020\A54f\Drawing965.DWG" Module="0" Save="C:\Users\...
Priora's user avatar
  • 35
0 votes
1 answer
337 views

Combining two txt files containing name and last name on command line

I have two text files. First file have 20 Names listed in seperate lines and 2nd file have 20 surnames listed in seperated lines. How I can combine those files. So final text file have both first name ...
Roxion's user avatar
  • 354
2 votes
1 answer
111 views

Shell special chars blowing up regexp(s) in all: sed, (g)awk, and perl [closed]

I would like to change the PS1 in my ~/.bashrc programmatically with any of the the most popular regexp tools { sed, awk or perl }. However, I have problems with special characters. Note that in the ...
ubixy's user avatar
  • 21
0 votes
1 answer
156 views

Transpose vertically with a catch

I've been working through some issues preparing data for logstash ingestion. I have a decent chunk of the process worked out but I'm wondering if there's a better way to do this. Basically I need to ...
Steve Zemlicka's user avatar
2 votes
2 answers
650 views

Combine strings with same first word preserving their order

I have a file that contain many lines consecutive and non consecutive with same first word and i want to merge all those lines.Not finding any way. please suggest someone. eg. cat file X blah blah ...
Daichi Ash's user avatar
0 votes
3 answers
1k views

sed + how to replace numbers with parenthesis with sed/awk/other

we want to relapse the [1023,1024,1022] as described in the following file , with [1022] more file.exm {"topic":"nj_hgf_dfgef","partition":0,"replicas":[1023,1024,1022]}, {"topic":"nj_hgf_dfgef","...
King David's user avatar
0 votes
1 answer
529 views

awk + print lines only if second field match hours:min:sec

log file is like this 34.3.23.58 07:20:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97 34.3.23.58 07:30:01 AM all 0.02 ...
King David's user avatar
1 vote
1 answer
251 views

Sed / awk / perl text editing on n lines after match

I'm strugling with this. I'm trying to edit the next 6 lines after a match, by adding text before each lines, and double quotes before and after the existing number on each lines. What my file look ...
Roxxxance's user avatar
1 vote
1 answer
87 views

print the number in second col the number of times in a new line always as specified in col 1

how do I print the value in col 2 as many times as it is specified in col 1. 10 -11 9 -10 7 -9 7 -8 7 -7 12 -6 362 -1 271 1 94 2 41 3 17 4 13 5 16 6 5 7 expected output: -11 -11 -11 -11 -11 -11 -11 ...
Gavin's user avatar
  • 13
3 votes
2 answers
284 views

To override the contents of files

I have two files, file1.txt and file2.txt, file1.txt is: perimeter a=10 perimeter b=15 perimeter c=20 file2.txt is: perimeter a=12 perimeter b=14 Let me know the sed or Perl to override the values ...
Python_geek's user avatar
0 votes
2 answers
114 views

linux: how to capture the number/s from string

I use the following syntax in order to capture only the number from machine hostname echo machineLinux05 | sed s'/\./ /g' | awk '{print $1}' | sed 's/[^0-9]//g' 05 But this way is not so elegant. ...
enodmilvado's user avatar

15 30 50 per page