Комментарии:
Something I didn't say in the video:
`> file` will not output the file visually in all shells although it does make the file content available to commands like grep in all shells, like I illustrated. It does output the file in my shell (zsh) but it will not output it visually in bash or POSIX sh, although there might be a setting to enable it to do that in bash (I wouldn't know).
i use "grep '' filenamae" to view files
Ответитьi was unaware that grep could take a file. however there is no way im going to use > to read a file...SEE THERE! ALREADY TYPO'ed IT! dang it.....
ОтветитьCat abuse!!!!
ОтветитьYou blew my mind, again! I am now going to conserve electricity and become a much more sensible person!
ОтветитьI'm not one of those "cat grep" people. The switch "-H" in grep tells grep to give the filename the pattern is found in. with "-n" you can get even the linenumber.
Thos "direct filenames" is not working, if there are many files, then "find" with "-exec" comes in place.
get bat and bat-extras for better cat, grep, less, diff, and some other options also :)
ОтветитьPipe grep into cat instead! ;-)
Ответитьbefore watching this i used to cat into less, i tried directly less <filename> and it works :)
ОтветитьFirstly, don't tell me how to live my life 😂 And secundo, if there's supposed to be (imo there isn't) a 'right' and a 'wrong' way to do it, I'd say piping into grep has more advantages and closer to *nix ethos than just using grep.
ОтветитьMore more more more!!!!
I love this!!! These videos help so much!!
Pfff
ОтветитьRTFM
Ответитьwhy is he wearing sunglasses inside a room
Ответить"< file" is a bashism so OK on the command line but you probably shouldn't be using it in a script.
ОтветитьPeople who use cat | grep also use curl | sh.
ОтветитьNever realized a redirect-input could be used dyslexic-like, I always treated it like an arrow: tohere < fromhere.
head and tail are where it's at for writing file content to stdout. At least if you ever scrollback.
What I find strange is redirecting into cat.
cat < afile
Which, at least back when I was new to bash, seemed to be the standard teaching example for a redirect.
I have been using Unix since 1978. I do everything from shell scripts to kernel programming in C and I often start something with cat. So be a good puppy.
ОтветитьI'm guilty of this lol
Ответитьdo linguistic phd students study theory of computation ?
Ответить