Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix line numbers for multiple files #10

Closed
wants to merge 1 commit into from

Conversation

SimonCW
Copy link

@SimonCW SimonCW commented Sep 1, 2022

This fixes the differences to the cat implementation for multiple files. See #9

Unfortunately, I haven't found a fix while still using enumerate. So, this kind of deviates from the text in the book.

@kyclark
Copy link
Owner

kyclark commented Feb 13, 2023

This is a different implementation of cat that numbers all lines without resetting for each file. The version I was implementing starts over at 1 with each file. There's nothing wrong with this PR, and it fixes the test input nicely, but I was implementing a different program.

@kyclark kyclark closed this Feb 13, 2023
@rdlu
Copy link

rdlu commented May 2, 2023

I found the same issue using the mk-outs.sh on my system. It generates line number 1..13.

I'm using Fedora 38 with cat (GNU coreutils) 9.1.

Another solution is using bat, a cat replacement in rust. But it doesn't support -b, only -n.

So I think this is just the cat on MacOS that presents this behavior. There's a bsdcat on Fedora repo, but it doesn't supports any flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants