Search and replace html tags in sed recursively -
I am trying to write a script to search and delete HTML and HTML tags from all files. The starting point is given in the form of input in order to run the script. As a result, the file should be saved in the new file in the same place that ends with _changed. E.g., Start.html> start.html_changed I have written so far the script. It works fine, but prints out on the output terminal, and I want to save it in the file, respectively.
#! / Bin / bash sudo $ 1 -name '* .html' type f -print0 | Xargs-0 sed -n '/ & lt; Div /, / & lt; \ / Div & gt; / P 'sudo $ 1 -name' * .htm '-type f -print0 |
Any help is appreciated.
The following script:
works just fine, but it is not recursive how can I make it recursive?
#! / Bin / bash for L in /$1/*.html sed -n '/ & lt; Div /, / & lt; \ / Div & gt; / P '$ l & gt; "$ {L} _nobody" / $ 1 / * HTML is used for M-sed -n '/ & lt; Div /, / & lt; \ / Div & gt; / P '$ m & gt; The xargs part is as follows: xargs-0-i {} sh -c "sed -n '/ Explanation: -
> -i {}
: sets placeholder -
& gt; {} _changed "
: Redirects the file with _changed
suffix
Comments
Post a Comment