Skip to content
Advertisement

Grouping some lines into one

I have an hosts file and I need to group multiple lines into one, using Linux standard commands; starting with this:

JavaScript

I want this:

JavaScript

The ip address is always the same, and I can easily remove it to simplify the work; the file can reach 30K+ lines, so my goal is to reduce its size using as few resources as possible (I’m working on a router with OpenWRT). Using tail and head I can get a group of lines, but then I don’t know how to put them on a single line (substite n with a space doesn’t seem to work).

Advertisement

Answer

How about this:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement