Hello. Question 1
In folders I have filenames with spaces ( generally .desktop files ).
Folder names has no newline nor spaces.
I have tried two syntax, one works the second not.
I would like to know why.
This works :
Question 2
As said filenames may have spaces ( generally .desktop files ).
Folder names has no newline nor spaces.
If I use -print0 as actions that mean that the output is ‘\0’ terminated even if there are no special characters in the file names.
‘\n’ is just replace by ‘\0’.
Question 3
I use ‘| xargs -I{} someCMD {}’ .
Is it sufficient even if I use ‘print0’ in the find part side; or must I use the option -0 accordingly in the xargs side.
Question 1
Script 1 works → all 25 files are open at ounce in kate
Script 2 does not works → files are open one by one in kate. You must close the first one to have the second opened in kate, then closer the second to get the third one , and so on.
Question 2
What I want to know is one use ‘print0’ because one want a ‘\0’ to separate the flow even it is not necessary (there is no linefeed in the filenames so technically there is no need to use ‘\0’ as separator ).
You want -print0andxargs -0 because the shell you are using to execute these commands uses spaces to separate command line arguments. If you give it a file name with one space, it is seen as two files.
Not necessary? For a robust solution you need this. If it is too much typing or you too easily forget things, make a alias that combines find -print0 and xargs -0 in one handy shortcut.
On the difference between 1 and 2, can you first explain why you want to use 2 if 1 is working? If it only is to educate yourself, it is likely better to find out yourself, do so you learn more.
I have tried tens of syntax to load at ounce kate with a list of files to edit.
The penultimate test was with ’ | xargs -d ‘\n’ kate’ and failed to load the files at ounce. Kate was showing the files one by one. Closing the current made the bext to show up.
The last with ‘| xargs -I{} kate {}’ seems to do what I want (loading all the files at ounce).
Concerning the spaces in the .desktop filename, what about the following :
ID -u is : 1000
$0 is : /run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_ALL_SCRIPT_step_1_002.sh
$@ is :
PWD is : /home/user_install
ID is : uid=1000(user_install) gid=100(users) groups=100(users),464(vboxusers)
find /run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT -type f ! -name “*~”
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_edit_main_script.sh.keep.1
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_ALL_SCRIPT_step_1_002.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_script_upgrade_user_script.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/RUN UPGRADE USER SCRIPT.desktop
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/EDIT UPGRADE_USER SCRIPT.desktop
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_edit_main_script_session.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_ALL_SCRIPT_step_1_001.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/main_mandatory_machine_script.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/edit_edit_main_script.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/main_script_machine.sh
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/EDIT EDIT MAIN SCRIPT.desktop
/run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT/RUN MAIN SCRIPT.desktop
find /run/media/user_install/INS_STEP2_MINI/NEW_INSTALL_LINUX_2023/2023_12_14_17h00/MY_PROJECTS/MY_INSTALL_STEP_1/2023_12_01_19h31/001_SCRIPTS/003_MAIN_SCRIPT -type f ! -name “*~” | xargs -I{} ls -al {}
No thanks, one note, please spend some time thinking about the people your are communicating with. So if somebody asks something try to answer that and if you have output to share, please summarize it so that people do not have to search for information. That also helps you in the sense you get better responses.
In this case I overlooked the spaces in your previous message, that could have been prevented using:
So you want to open Kate for every found file, that means you normally you have so start Kate separate for each file. If so, have a look at “man find”, second option under “ACTIONS”. There is also an EXAMPLE.