Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.11 KB

recipes.md

File metadata and controls

45 lines (32 loc) · 1.11 KB

sed vs. essed

I have picked top questions from StackOverflow where sed is a good choice. Choose right tools for your purposes - sed is optimized C code and it's installed on most of Unix systems. awk is extremely powerful.

essed is intented to be used mainly for development with familiar JavaScript syntax and it will be significantly slower.

Task: Delete lines in a text file that containing a specific string

sed:

$ sed '/pattern to match/d' ./infile

essed:

$ essed --filter '!line.match(/pattern to match/)' ./infile

Task: Extract a predetermined range of lines from a text file on Unix

sed:

$ sed -n 16224,16482p filename

essed

$ essed --filter "_.inRange(i, 16224, 16482)" filename

Task: get nth line from a file

Comment: I recommend to use sed here. find is on road map.

sed:

$ sed '209q;d' file

essed: TODO