Commit b9649a6
committed
cut: fix -s flag ignored when delimiter is newline
When using newline as the delimiter (-d $'\n') with -s (only-delimited),
cut should suppress lines that do not contain the delimiter. However,
cut_fields_newline_char_delim() was not checking the only_delimited flag,
causing it to always output even when -s was specified.
This commit:
- Adds only_delimited parameter to cut_fields_newline_char_delim()
- Checks if input has no delimiter and only_delimited is true, returns early
- Adds test case for newline delimiter with -s flag
Fixes #100121 parent 81ee8d1 commit b9649a6
2 files changed
+35
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
274 | 282 | | |
275 | 283 | | |
276 | 284 | | |
| |||
303 | 311 | | |
304 | 312 | | |
305 | 313 | | |
306 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
307 | 322 | | |
308 | 323 | | |
309 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
304 | 323 | | |
305 | 324 | | |
306 | 325 | | |
| |||
0 commit comments