私の要件は、~(バックアップファイル)で終わるファイルを除く、ディレクトリ内のすべてのファイルをリストすることです。
私はコマンドを使用しようとしました:
ls -l | grep -v ~
私はこの出力を取得します:
asdasad
asdasad~
file_names.txt
normaltest.txt
target_filename
testshell1.sh
testshell1.sh~
testshell2.sh
testshell2.sh~
testtwo.txt
testtwo.txt~
test.txt
test.txt~
これらのファイルのみを取得したい:
asdasad
file_names.txt
normaltest.txt
target_filename
testshell1.sh
testshell2.sh
testtwo.txt
test.txt
ls -l(文字ell)には、リストされた各ファイルの許可、nlinks、所有者、サイズ、およびmodtimeが含まれます。表示する出力はls -1(桁1)で、多くのシステムで-1は端末で単一列の出力を生成する必要がありますが、lsパイプ(ここに示すようにgrep)またはリダイレクトされる場合-1は不要で、すでに単一列です。
~。これらのファイルは、いくつかのテキストエディターで作成されたバックアップファイルです。