検索されたファイルをディレクトリに移動できません。

検索されたファイルをディレクトリに移動できません。

次のコマンドの出力は次のとおりです。

$ rga --heading -l --context 3 --sort path -i -e "use cases?" -e "user stor(y|ies)" -e "Technical debt"

Stepanek G. - Software Project Secrets (The Expert's Voice in Project Management) - 2012.pdf
Strategic Project Management Made Simple Solution Tools for Leaders and Teams (Terry Schmidt) (z-lib.org).pdf
Succeeding with Agile Software Development Using Scrum.pdf
Team Topologies Organizing Business and Technology Teams for Fast Flow (Matthew Skelton Manuel Pais [Skelton etc.) (z-lib.org).epub
The Agile Samurai How Agile Masters Deliver Great Software (Jonathan Rasmusson) (z-lib.org).pdf
The Art of Agile Development - James Shore & Shane Warden.pdf
The Art of Lean Software Development a Practical and Incremental Approach (Curt Hibbs Steve Jewett Mike Sullivan) (z-lib.org).pdf
The Art of Project Management - By Scott Berkun.pdf
The Complete Software Project Manager Mastering Technology from Planning to Launch and Beyond by Anna P. Murray (z-lib.org).pdf
The Enterprise and Scrum (Ken Schwaber) (z-lib.org).pdf
The Fast Forward MBA in Project Management 3rd Edition (2008) (Portable Mba Series) (Eric Verzuh) (z-lib.org).pdf
The Making of a Manager (Julie Zhuo) (z-lib.org).pdf
The Manager’s Path A Guide for Tech Leaders Navigating Growth and Change (Camille Fournier) (z-lib.org).epub
The PMI Guide to Business Analysis (Project Management Institute) (z-lib.org).epub
The Phoenix Project.pdf
The Rational Unified Process An Introduction (Philippe Kruchten) (z-lib.org).pdf
The Scrum Field Guide Agile Advice for Your First Year and Beyond (Lacey Mitch.) (z-lib.org).pdf
The Unicorn Project A Novel about Developers, Digital Disruption, and Thriving in the Age of Data by Gene Kim (z-lib.org).epub
The rational unified process made easy a practitioners guide to the RUP (Per Kroll Philippe Kruchten) (z-lib.org).pdf
Tim_Brizard-Broken_Agile-EN.pdf
Visualizing Project Management - Models and Frameworks for Mastering Complex Systems by Kevin Forsberg, Hal Mooz, Howard Cotterman (z-lib.org).pdf
essential-scrum-a-practical-guide-to-the-most-popular-agile-process.9780137043293.57714.pdf
succeeding-with-agile-software-development-using-scrum.9780321579362.53099.pdf

これらのファイルを別のディレクトリに移動しようとしています。

私が試したコマンドは次のとおりです。

rga --heading -l --context 3 --sort path -i -e "use cases?" -e "user stor(y|ies)" -e "Technical debt" | xargs -I {} mv {} DEST

そして

rga --heading -l --context 3 --sort path -i -e "use cases?" -e "user stor(y|ies)" -e "Technical debt" > files.txt
for file in $(cat files.txt); do mv "$file" DEST; done

入っています(状態xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option

そして

rga --heading -l --context 3 --sort path -i -e "use cases?" -e "user stor(y|ies)" -e "Technical debt" | xargs -r0 mv -t DEST

そして

for file in $(cat temp.adoc); do mv "$file" "DEST/$file"; done

それは言うmv: cannot stat '''Stepanek ...

ベストアンサー1

GNUxargsmvシェル(bash)を使用すると、次のことができます。

xargs -rd '\n' -a <(rga...) mv -t DEST/ --

なし-d(または-0略語-d '\0')、およびはxargsまだ参照演算子として理解されています。'"\

使用xargs -a <(...) cmd(zshやbashなどのkshスタイルのプロセス置換を持つシェルが必要ですが、他のシェルは同様またはrc他の構文の機能esもあります)を使用するとstdinとの対話が可能になり、場合によってはユーザーにDownメッセージを表示するできるのでfish使用するよりも優れています。... | xargs cmdcmdmv

これにより、プロセスを作成し、各ファイルに対して実行することなく複数のmv -t /DEST ...ファイルを渡すことができます。mvmv

おすすめ記事