0

When running wc -l models.txt, we get the output which looks like 2113 models_work.txt. I wonder how to get the 2113 from that output using the cut command or something along those lines. It doesn't work when combined with the cut command like wc -l models.txt | cut -f1. Any help would be appreciated! Tks!

6
  • 5
    wc -l < models.txt for a single file, because wc will not then show any filename. Commented Nov 1, 2023 at 10:09
  • @Paul_Pedant what a great comment! Tks! Commented Nov 1, 2023 at 10:10
  • 4
    Side note: it does work with cut, you just need to cut at spaces, not at tabs: cut -d ' ' Commented Nov 1, 2023 at 10:11
  • it seems that cut does not have the option -d, @KamilMaciorowski! Commented Nov 1, 2023 at 10:19
  • A quite limited cut then, as -d is in the POSIX specification. Commented Nov 1, 2023 at 10:21

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.