1

I have a file named as abc.txt and I am trying to extract no of records present in the file and the file creation date.

wc -l abc.txt  

This is giving me only no of records in the file.

How to get the count and the data at a time in a single command?

4
  • Why do you believe that such a single command exists? See also Get file created/creation time? Jul 18 '19 at 17:16
  • 1
    If instead of a single "command" you just want a single line, you can always string together different commands with the && operator. For example wc -l abc.txt && stat abc.txt Jul 18 '19 at 17:43
  • 2
    What's this fascination with doing things in a single command or on a single line? I really don't get it. Most operations done in multiple stages are unreadable if written on a single line, and as such, they are unmaintainable and should be avoided.
    – Kusalananda
    Jul 18 '19 at 17:53
  • @Kusalananda Thanks for the responses. I have around 1000 files and need to get the count and data of all the files into a single file. This is what I am trying to achieve
    – Rak kundra
    Jul 22 '19 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.