BSD sed/awk moving portion of line to line above (switching attribute in HTML file)
0
votes
2
answers
106
views
My situation is simple : I have an **HTML file with several lines** containing only the indented **`
block tag**, each line **followed by** an (also indented)
...
` **title tag**. Like so :fr 2024 en
**When using the anchored link** to go to a specific year within the page (or its translation), **the year title goes to hide** behind the ``.
The **problem would be solved** by switching the id
attribute one line up from the
to the `` tag,
like so :
fr 2024 en
Is there a simple one-liner or command that would permit me **to switch all these id
attributes from the
tag to the ` tag one line further up ?** I have not found how to match multiple lines in
BSD
sed or especially
awk`.
's:\(\s*\)
does not change the file. Neither does \n\t\t
in place of \s
, or using double backslashes escapes.
Is there an option to match for space characters like I assume GNU
sed
would ? **Only perhaps the insertion/use of newlines/tabs directly in the command**, but I would like to learn better and am also forced since I am working remotely and have to use termux
on Android
... Also I am not skilled enough to use an awk
workaround.
Asked by sylvansab
(109 rep)
Dec 8, 2024, 05:40 PM
Last activity: Feb 10, 2025, 08:52 PM
Last activity: Feb 10, 2025, 08:52 PM