Timeline for sed: delete all lines before matching one, including this one
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 8, 2019 at 19:23 | comment | added | Ed Morton | @Isaac Hmm, I may have been too quick to say "well-documented". I thought it was but I just googled and looked through the POSIX spec and the gawk manual and couldn't find it so I emailed the gawk maintainers and asked them to add it to the next revision of the manual. | |
| Aug 8, 2019 at 18:53 | comment | added | Ed Morton |
That's just the well-documented awk 'script' './var=value file'
|
|
| Aug 8, 2019 at 18:45 | comment | added | user232326 |
That makes sense. However, if a file is named var=value file, awk will set a variable inside awk in either awk '...' "var=value file" or in awk '...' 'var=value file' even in awk '...' "$file" or the should be avoided in any case awk '...' $file. How to quote that?. Thanks in advance.
|
|
| Aug 8, 2019 at 18:31 | comment | added | Ed Morton |
@Isaac Because <file strips you of the ability to access FILENAME and isn't extensible to use with multiple input files which is a very common situation when using awk. If your file names contain odd characters just quote them appropriately in either case and it makes no difference which approach you use in the call to awk. The only mild benefit to using <file is in the error case - if file doesn't exist or can't be read then if you write awk '1' foo > bar then bar is created while with awk '1' <foo > bar it isn't and you get an error message from the shell instead of from awk.
|
|
| Aug 8, 2019 at 18:28 | comment | added | user232326 |
Hi, Ed, why not better <file instead of file for really odd named files?
|
|
| Aug 2, 2019 at 23:40 | history | edited | Ed Morton | CC BY-SA 4.0 |
added 96 characters in body
|
| Aug 2, 2019 at 23:32 | history | answered | Ed Morton | CC BY-SA 4.0 |