Skip to main content
11 events
when toggle format what by license comment
Apr 6, 2017 at 15:59 history edited Stéphane Chazelas CC BY-SA 3.0
added 174 characters in body
Apr 6, 2017 at 14:40 comment added Stéphane Chazelas @Kusalananda, no, RS= is the paragraph mode. For slurp mode, see Slurp-mode in awk?
Apr 6, 2017 at 10:50 comment added Thor Remove the new-lines before doing substr, e.g. gsub("\n", "")
Apr 6, 2017 at 10:01 comment added George Vasiliou @Kusalananda Probably you are right....
Apr 6, 2017 at 9:45 comment added Kusalananda @GeorgeVasiliou I think that because RS is empty, the whole file is read before it gets to the substr() call.
Apr 6, 2017 at 9:35 comment added George Vasiliou Since you need to print only the first 80 chars, adding ;exit after print substr(..) might help to improve performance forcing awk to exit and not read the rest file.
Apr 6, 2017 at 9:26 comment added ilkkachu Also, I think you need to count one character for the newline in the middle. (Now you're missing the final T from the example.) That gets more annoying if the part to be picked is longer, and especially if the lines are of different lengths for some reason.
Apr 6, 2017 at 9:21 comment added Kamaraj yes.. that's correct. if the file size is very big.. then we encounter with slowness.
Apr 6, 2017 at 9:17 comment added Kusalananda I wonder... Does awk read the whole file into memory when doing it that way?
Apr 6, 2017 at 9:13 comment added gugy alright, that works. thx!
Apr 6, 2017 at 9:10 history answered Kamaraj CC BY-SA 3.0