All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1
votes
1answer
60 views

How do I exclude pre tags from HTML minification using sed?

I am trying to minify HTML using sed My problem: I don't want to minify anything inside <pre> tags, but can't make it work.. Here is what I am using: sed ':a;N;$!ba;s@>\s*<@><@g' $...
1
vote
2answers
53 views

Howto find the size of a remote http/https directory (non recursively) using a given regexp from the command line

I'm trying to find the size of a remote http/https directory (non recursively) using a given regexp (\.mp4) from the command line, is there a tool to do so or do I need to parse the index.html ? ...
1
vote
1answer
70 views

Placing the last line first in each html <ul> with sed

I try to place the line "name: *****" just after the corresponding (innermost containing) "ul" each time an "ul" appears, so that it looks like this: Before: <ul> <ul> <li ...
0
votes
1answer
63 views

bash script to replace script tags in html with their content

is it possible to use sed to match the source of a script tag within html (which is not valid xml) and replace the whole match with the files' contents? e.g. say the html contained <link rel='...
1
vote
4answers
243 views

sed find and replace html tag

I need find and replace in a md file (plain text) <span class="symbol">&#58771;</span> with this: [&#58771;]{custom-style="symbol"} I tried many times, f.e. sed -i -e 's/\(&...
0
votes
1answer
33 views

Finding and replacing text when there are custom elements within [duplicate]

I have about 450 html files I need to edit. I have the directory they all are in, so that narrows things down from the perspective of searching. What needs to be changed is a bit of known text, some ...
0
votes
1answer
168 views

I need to replace a string in html sed is not working

Here is the code in the shell script I have used sed 's/xyxx/$date1/' /u001/Scripts/abc.html > /u001/Scripts/abc.html The code is trying to print HTML tags inside AWK command nawk 'BEGIN{ ...
0
votes
1answer
56 views

How to extract a pattern of multiple lines

I am wondering how to extract a pattern of multiple lines, especially when this pattern is repeating in the text. The text looks like this: <tr> <td>Wife</td> <td>Pilialo</...
0
votes
2answers
336 views

Using bash to replace html character entities in the xml file

I have a string like this in xml file: &lt;h3&gt;Styled here with: &lt;a href="$url('Product-Show','pid','107723102')$"&gt;FRS blo&lt;/a&gt;, &lt;a href="$url('Product-...
4
votes
4answers
518 views

Use sed to encapsulate the first word of each paragraph with <i> </i>?

So obviously I am trying italicize the first word of each paragraph in a huge document. I think its relatively easy to add the prefix but how do I delineate just the first word for the postfix instead ...
1
vote
2answers
389 views

Change the background color (html format) if a number is less than a threshold

I have the folowing file which is called test.html: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta name="generator" content="SQL*Plus ...
1
vote
2answers
1k views

How to insert text between two set patterns with sed?

I need to insert text between two set patterns in a large set of files. I need to change every line with this form: <a href="/entry/someFile"> To this: <a href="/entry/someFile.xhtml"> ...
-1
votes
1answer
554 views

sed to insert a html values in a specific line number

I was trying to insert a values in between html tags in a specific line number. Also it should ignore whitespaces at the beginning. Example :- line 15 should be replaced <john></john> ...
-2
votes
2answers
164 views

Read file until match pattern [closed]

I´m reading a file and I would like to get the info until I found a match. So having the file here https://ufile.io/182kx I would like to have the json info from lastActiveTimes: until I found ,...
2
votes
2answers
2k views

Formatting file in HTML output

I have a little script that will format a log file with all failed logins for users on the system. I have written the script to output the data in a text file in this format (two columns with the ...
0
votes
1answer
332 views

What does this sed command do? How to change it?

I do not understand what does this command do: grep '<span id="geodata" class="geo">[-0-9.]*; [-0-9.]*</span>' -R articles/ --only-matching | sed 's@articles//@@' | sed 's@:<span id=....
0
votes
2answers
515 views

sed to replace text url to html url

I have a bunch of URL in a text file. As Firefox seems unable to load these URL directly, I must convert them to HTML. Trying with sed doesn't work: sed -e 's/^(.*)$/<a href="\1">\1<\/a>&...
0
votes
1answer
2k views

Bash script to extract values from HTML

I am trying to extract counter values from a HA7NET 1wire device server, but I am not so used with sed or awk or bash scripts so I am running in to problems. This script gives me an array with the ...
2
votes
2answers
180 views

Best way to insert blocks of HTML in bash

I have been working on a script that collects data about servers and formats them into a nice html email report. I have been using sed to replace values in a html template so far and that has been ...
2
votes
5answers
1k views

Need to extract a number from HTML

Given this: <p>Currencies fluctuate every day. The rate shown is effective for transactions submitted to Visa on <strong>February 5, 2017</strong>, with a bank foreign transaction ...
0
votes
2answers
471 views

How to remove newline character between two strings <font>\n</font> in unix?

I want to remove the newline between two html tags which exists as follows: <font> </font> I want to remove the newline character such that it becomes: <font></font> Also, ...
1
vote
1answer
381 views

Adding/removing some tabs and line breaks in an HTML code using sed

I want to refine an HTML code using sed, as an extra refinement procedure after refining it using HTML Tidy, as HTML Tidy doesn’t look flexible enough for some requirements. I used this command to ...
1
vote
2answers
2k views

parse HTML in Bash (when grep just isn't enough)

This is driving me insane, as I'm sure there must be some program doing the job but I just can't find it. To be noted, I'd be on ARM/Raspberry so unfortunately Xidel is not an option here, unless ...
4
votes
4answers
1k views

Extracting strings from between special characters

I have a large text file created from combining lots of html files. cat *.html > all_html_files.txt Inside the text file are specfic strings that I want to extract to another text file. For ...
1
vote
1answer
173 views

Add text between multiple lines with sed if previous line does not match pattern

I'm struggling to add <dl> tags around a definition list with sed, and perhaps there is an easier way to do it (I'd love to know). I would like to search a file for any lines that contain a <...
2
votes
3answers
1k views

Shellscript to remove particular tags in HTML file

Can anyone please guide me with writing Shell Script command for following scenario. I have an html file with all tags in a single line like this, <html><head></head><body>&...
0
votes
1answer
775 views

sed html parsing

I have to parse HTML to change text between two brackets that are not HTML code back to &lt; or &gt;. Here an example of my HTML code that I have to replace: <content:encoded><![...
2
votes
1answer
180 views

Sed: replace text keeping digit occurrence

I have some text like: Blablabla <b>[intlink id="</b>2204<b>" type="page"] Blalala I want replace it for remove the </b> and <b>, keeping the id="number". So it should ...
1
vote
2answers
1k views

Script to remove certain span elements from an HTML file

I want to write a script that completely removes every instance of a particular span class from a given HTML file. For example, if my undesired span class is "foo" then running my script on the file ...
0
votes
2answers
2k views

AWK, SED or GREP for extracting data from HTML file

Can anyone tell me which is best to use to extract the following data from a html file which was received with curl . <script>document.getElementById("test-summary").innerHTML = "<strong>...
0
votes
1answer
1k views

Convert particular lines in a text file to bold [closed]

I have a text file with 100 lines in it. I want to convert particular lines, lets say line1, line6 , line27, line 48, line 86, line99 to bold. I am using solaris 5.10, with KSH. Is there a way I can ...
0
votes
3answers
3k views

How can I delete html tags from a file using sed?

I have a file that is mixed with both normal text I need and html-tags. I know that with REGEX it is possible to recognize html tags and with sed one can swap those for an empty string, but I do not ...
1
vote
1answer
1k views

Sed: search and replace a patten with special characters which has a arbitrary string in between

I have a load of nfo files which I want to make some global substitutions for some values within each file e.g. a.nfo has the value <set>Tonight&apos;s Menu ( June 2012 )</set> ...
2
votes
2answers
5k views

any command that can format html or xml from shell? [closed]

There must be something on the lines of sed? Normally in sed you type something like: echo day | sed s/day/night/ the shell prints "night". Is there something that can take a file (containing xml/...
0
votes
3answers
1k views

Inserting the results of a for loop into an html file - BASH

I have a script that takes the results of a command and puts them into a html code. Here's what I have so far... #!/bin/bash list_dir=`ls -t downloads/` for i in $list_dir do #---- # echo "...
22
votes
7answers
66k views

Text between two tags

I want to retrieve whatever is between these two tags – <tr> </tr> – from an html doc. Now I don't have any specific html requirements that would warrant for an html parser. I just plain ...
1
vote
1answer
276 views

how to add a description in footer

I enjoy learning how to modify files with awk, sed, and bash. However, I know it could cause issues down the road and I would like to be prepared with a log inside the file. I was thinking about how ...
0
votes
1answer
708 views

globbing, sed, or awk html files

I wanted to create a script that I could check .xhtml files for images and add alt tags if needed. While searching I found regular expressions and did man on glob but I'm unsure on where or what to ...