Use find + xargs to edit multiple files at once with KDE Kate
0
votes
1
answer
52
views
The problem: Edit many files in one single kate process.
1) FILE_LIST is a variable which contains a list of path
FILE_LIST="$MAIN_PATH1 $MAIN_PATH2 ... $MAIN_PATH3"
2) DST_DIR is the destination folder in
/tmp
for the symlink of the files to edit.
3) A for - loop feed a find request
4) The find request uses xargs to build the link files; one uses print0/-0
because some filename contains space
for A_DIR in $LIST_PATH ; do
find "$A_DIR" -type f ! -name "*.*~" ! -path "*000_ERRORS*" ! -path "*KEEP*" -print0 | xargs -0 -I@ bash -c " ln -s \"@\" \"$DST_DIR/${@##*/}\""
done
5) Up to here everything is alright. All symlinks are in one folder.
6) Then another finds request feed kate at once.
find "$WORK_PATH" -type l -print0 | xargs -0 -I{} xdg-su -c "kate {} "
That does not work as expected. Files are only accessible one by one. That is not the goal.
But in another terminal if I run manually second find request command :
find /tmp/000_PGM_001 -type l -print0 | xargs -L 1 -0 -I{} bash -c "kate '{}'"
I may obtain all the files in the same instance. I may manually repeat the command until I get all the files in one kate install.
Asked by jcdole
(3 rep)
Dec 7, 2023, 10:17 PM
Last activity: Dec 16, 2023, 12:49 PM
Last activity: Dec 16, 2023, 12:49 PM