Skip to main content

All Questions

Tagged with
0 votes
5 answers
78 views

Match multiple vars across two lines and delete entire entry

MATCH1.MATCH2 { always same MATCH3 } All three MATCH(es) must match. input: foo.bar { always same bus } 1.2 { always same 3 } a.b { always same c } i.ii { always same iii } b.2 { ...
sloppy's user avatar
  • 121
0 votes
1 answer
89 views

Use sed to replace only part of a string

I'm trying to replace bobearl with jim in the following string "billy" "bobearl" and "johnny" I can do something like this: sed 's/bob/jim/' /tmp/text.txt "billy&...
goswell's user avatar
1 vote
3 answers
84 views

Loop ip list through geoiplookup and delete lines that do not match criteria

Thanks in advance for any ideas you present. My current project has me trying to loop a file containing a list of 1000's of IP addresses through geoiplookup and piping it to sed to delete all lines ...
user avatar
3 votes
5 answers
645 views

removing braces statements containing nested braces inside

A typical latex problem: \SomeStyle{\otherstyle{this is the \textit{nested part} some more text...}} Now I want to remove all \SomeStyle{...} but not the content. Content contains nested braces. The ...
Thierry Blanc's user avatar
1 vote
3 answers
76 views

How do I merge bottom line with previous line? [duplicate]

I have a pretty basic file; 15 Chapter name some text and some more text some text and some more text I was trying to get something like this Book: 15 Chapter name some text and some more text some ...
learningregularexpressions's user avatar
0 votes
2 answers
89 views

BSD sed/awk moving portion of line to line above (switching attribute in HTML file)

My situation is simple : I have an HTML file with several lines containing only the indented <section> block tag, each line followed by an (also indented) <h3 id="YYYY">...</...
sylvansab's user avatar
  • 109
0 votes
2 answers
103 views

How to insert text before the first line of an UTF-8 with BOM file

This question is closely related to: How to insert text before the first line of a file?. I deliberately made the title similar to that question to highlight this. Except the target file is UTF-8 with ...
Avenger's user avatar
  • 151
2 votes
3 answers
86 views

Printing a specific section everytime search results are matched

I have a pretty basic text file on a Linux machine that has stuff like Chapters, Dialogues and References. This is what it looks like Chapter: 1 One: Birds and Trees Birds are beautiful and trees ...
learningregularexpressions's user avatar
2 votes
5 answers
128 views

How to use sed to replace ID's in a file with names from a different file?

I'd like help writing a sed command to replace the ID's in one file with names from a different file. I have a file that looks like this: a b nSites J9 0 1 3092845 1 0 2 3139733 1 0 3 ...
seaborg1's user avatar
2 votes
5 answers
531 views

Move line matching string to top of the file

Need to move single line with PRM:TRG keyword to top of the file using sed File content: FOOBAR:SCN:NO_TRG FIZZBAR:SCN:NO_TRG BEBAR:PRM:TRG Output expected: BEBAR:PRM:TRG FOOBAR:SCN:NO_TRG FIZZBAR:...
netdis's user avatar
  • 131
1 vote
3 answers
112 views

sed: To match a newline and spaces

I have a following file: <head> <title>this is a title</title> <style> here goes a style sheet </style> </head> I need to strip the <title> element ...
jsx97's user avatar
  • 1,347
0 votes
3 answers
88 views

Need to make multiple multiline replacements in file

I have a file with multiple "paragraphs" like this: <type>TRANS</type> <attributes/> <specification_method>rep_name</specification_method> <trans_object_id/&...
Todd Porter's user avatar
4 votes
5 answers
1k views

Cut and replace Nth character on every row

I have predictable piped input, I want to iterate over each row and change two characters. the character positions are 19 and 20 (on every row.) The 19th character is a comma, I want to cut that. The ...
XJMZX's user avatar
  • 85
0 votes
1 answer
375 views

Add \t to jq resulted array extraction

I want to add \t before each element in the resulting jq array and this is for formatting purposes as the result will get added to a file. here is the json file: { "array": ["...
kyles's user avatar
  • 33
0 votes
5 answers
126 views

How can I replace the last occurrence of " before ] (text-manipulation)

I'm doing some text manipulation and I want to replace the last occurrence of " (with ", "four") before ] which could be in different lines. (this essentially adds a new item in ...
kyles's user avatar
  • 33

15 30 50 per page
1
2 3 4 5
158