Tagged Questions
3
votes
4answers
104 views
How to replace a list of strings by another list
I have a file which has (many) strings I'd like to replace, so I thought about using a simple command like:
sed 's/string1/string2/g' file1 > out
However, there are too many strings for that ...
2
votes
1answer
98 views
Delete first lines from a Unicode html file
I have an HTML file that is in UTF-8 format and I want to remove the first five lines from it.
I've tried using sed but it doesn't work in this case:
sed "1,5d" Result.html>small2
It actually ...
0
votes
2answers
213 views
Using sed, how to print all lines that match a certain date?
Using sed, how to print all lines where the birthdays are in November or December?
Assuming input file name "datebook" as follows:
Steve Blenheim:238-923-7366:95 Latham Lane, Easton, PA ...
2
votes
3answers
173 views
Adding text to the beginning and end of a number of files?
I have a number of files in a directory hierarchy. For each file, I'd like to add "abcdef" to the beginning, on its own line, and "ghijkl" to the end, on its own line. For example, if the files ...
2
votes
3answers
283 views
How to substitute multiple lines between delimiters
Given the text example:
.... text ,..
{{{python
string1 = 'abcde'
string2 = '12345'
print(string1[[1:3]])
print(string2[[:-1]])
}}}
.... text ,..
The [[ and ]] also appear outside of {{{ too. ...
0
votes
2answers
1k views
What is the ^I character and how do I find it with sed?
I usually import data from csv files to MySQL, but my data provider leaves NULL entries as "", so I need to replace "" with "\N". This is easy enough with a script like
for csvfile in *.csv
do
...
0
votes
2answers
1k views
Exclude some matches with sed
I have a series of files with entries(namespaces in source code) like
FW.WGS.Web.HHH.Controls, FW.WGS.Web.HHH.Email, FW.WGS.Web.HHH.Account, etc and some with entries
FW.WGS.Web.Controls, ...