3 ms·
OK I'll bite. For this answer I'll assume "easily" to mean "with less typing". ed has a more concise syntax for joining arbitrary lines of a file (by line num
by gwu78 13y ago
OK I'll bite. For this answer I'll assume "easily" to mean "with less typing".
ed has a more concise syntax for joining arbitrary lines of a file (by line number or pattern) and then saving the file (by way of a temp file in $TMPDIR). You could do this with awk and perhaps with other standard tools (note: I don't consider perl to be "standard"). But I think it's safe to say the ed script would always be shorter. ed's syntax for deleting and moving arbitrary lines is similarly concise. For these specific tasks, it's not going to be easy to win at code golf using awk or other tools... and in some cases it may be impossible.
- foobarbazqux 13y agoHey cool, thanks. I've always overlooked it.