Look up the URL in sitemap.xml without too big line breaks with Linux commands

I wanted to find out how many urls were written in sitemap.xml without line breaks that were too big, so I tried it quickly with a Linux command.

Insert a line feed code after </ url> and check the number of lines to make a judgment.

Even if I try to insert \ n to output the line feed code in the output of sed, the character n appears, so I ended up inserting the line feed itself from the command line. It won't work unless you enclose it in single quotes instead of double quotes. Don't forget the \ before the line break.

$ cat sitemap.xml | sed -e 's/<\/url>/<\/url>\
/g' | wc -l

The number -1 that came out should be the number of urls.

Recommended Posts

Look up the URL in sitemap.xml without too big line breaks with Linux commands
Ansible: Shows multi-line commands executed in the shell module with line breaks
Print with python3 without line breaks
Make the line breaks visible in journalctrl
Insert a date without line breaks in CotEditor
Crawl the URL contained in the twitter tweet with python
Output a character string with line breaks in PyYAML