diff options
author | Rob Landley <rob@landley.net> | 2018-06-14 14:50:02 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-06-14 14:50:02 -0500 |
commit | 851930b82dec1ac45cfb68c8d2958df947a4442e (patch) | |
tree | b5cbd9564ebc102df895ffbe159761223c1e00c0 /toys | |
parent | d63bc6849c2a3b6ff0b909390488cb423208d61d (diff) | |
download | toybox-851930b82dec1ac45cfb68c8d2958df947a4442e.tar.gz |
Fix cut -DF as awk replacement by not matching delimiterless lines with -D
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/cut.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/cut.c b/toys/posix/cut.c index f61073f1..83582aaa 100644 --- a/toys/posix/cut.c +++ b/toys/posix/cut.c @@ -29,7 +29,7 @@ config CUT -c select UTF-8 characters -C select unicode columns -d use DELIM (default is TAB for -f, run of whitespace for -F) - -D Don't sort/collate selections + -D Don't sort/collate selections or match -fF lines without delimiter -f select fields (words) separated by single DELIM character -F select fields separated by DELIM regex -O output delimiter (default one space for -F, input delim for -f) @@ -155,6 +155,7 @@ static void cut_line(char **pline, long len) // If we never encountered even one separator, print whole line (posix!) if (!j && end == start) { + if (toys.optflags&FLAG_D) break; if (toys.optflags&FLAG_s) return; fwrite(line, len, 1, stdout); break; |