I am working on running cat on all files with JS/JSX/SCALA extensions, I've tried the following
git ls-files | grep ".[js|jsx|scala]$"
git ls-files | grep ".*js|jsx|scala"
The end result will eventually look like this
git ls-files | grep -e ".*[js|jsx|scala]$" | xargs cat | wc -l
But I keep getting more files like yaml, yml
Use a group:
git ls-files | grep -E '\.(js|jsx|scala)$'
The \.(js|jsx|scala)$
pattern matches a dot and then js
, jsx
or scala
and then the end of string.
Mind the -E
option enabling POSIX ERE compliance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.