파일에는 mkisofs
다음과 같은 한 줄 문자열이 있습니다.
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 12.0.0 amd64 n' -o /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.iso -checksum-list /srv/cdbuilder.debian.org/src/deb-cd/tmp/2bookwormamd64/bookworm/checksum-check -jigdo-checksum-algorithm md5 -jigdo-force-checksum /pool/ -jigdo-min-file-size 1024 -jigdo-exclude 'README*' -jigdo-exclude /doc/ -jigdo-exclude /md5sum.txt -jigdo-exclude /.disk/ -jigdo-exclude /pics/ -jigdo-exclude 'Release*' -jigdo-exclude 'Packages*' -jigdo-exclude 'Sources*' -jigdo-jigdo /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.jigdo -jigdo-template /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.template -jigdo-map Debian=/srv/cdbuilder.debian.org/src/ftp/debian/ -jigdo-exclude boot1 -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus boot1 CD1
"-jidgo"로 시작하는 모든 모드 플래그와 해당 옵션을 제거해야 합니다. 이것은 제가 쓰고 있는 스크립트의 일부입니다. 로컬 또는 sed 옵션을 선호하지만 작업을 완료하기 위해 리소스를 늘릴 용의가 있습니다.
각 모드 플래그를 별도의 줄에 배치하고 실행한 후 제거할 수 있었습니다.
sed -i 's/-jigdo-[^-]*//' mkisofs
sed -i 's/-jigdo[^-]*//' mkisofs
이 메서드는 문자열로 남겨두면 아무런 효과가 없습니다. 또한 "jigdo-exclude"를 부분적으로만 제거하기 때문에 두 개의 명령을 만들어야 했습니다.
더 나은 보기를 위해 간격을 둔 각 행의 모양은 다음과 같습니다.
xorriso
-as mkisofs
-r
-checksum_algorithm_iso sha256,sha512
-V 'Debian 12.0.0 amd64 n'
-o /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.iso
-checksum-list /srv/cdbuilder.debian.org/src/deb-cd/tmp/2bookwormamd64/bookworm/checksum-check
-jigdo-checksum-algorithm md5
-jigdo-force-checksum /pool/
-jigdo-min-file-size 1024
-jigdo-exclude 'README*'
-jigdo-exclude /doc/
-jigdo-exclude /md5sum.txt
-jigdo-exclude /.disk/
-jigdo-exclude /pics/
-jigdo-exclude 'Release*'
-jigdo-exclude 'Packages*'
-jigdo-exclude 'Sources*'
-jigdo-jigdo /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.jigdo
-jigdo-template /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.template
-jigdo-map Debian=/srv/cdbuilder.debian.org/src/ftp/debian/
-jigdo-exclude boot1
-J
-joliet-long
-cache-inodes
-isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin
-b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4
-boot-info-table
-no-emul-boot
-eltorito-alt-boot
-e boot/grub/efi.img
-no-emul-boot
-isohybrid-gpt-basdat
-isohybrid-apm-hfsplus boot1 CD1
단일 행 문자열로 수정하면 다음과 같아야 합니다.
xorriso -as mkisofs -r -checksum_algorithm_iso sha256,sha512 -V 'Debian 12.0.0 amd64 n' -o /srv/cdbuilder.debian.org/dst/deb-cd/out/2bookwormamd64/debian-12.0.0-amd64-NETINST-1.iso -checksum-list /srv/cdbuilder.debian.org/src/deb-cd/tmp/2bookwormamd64/bookworm/checksum-check -J -joliet-long -cache-inodes -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus boot1 CD1
답변1
내가 간과하고 있는 것이 아니라면 이는 내가 수행한 일부 테스트와 일치하는 것 같습니다.
sed -i -r 's/-jigdo[^ ]+ [^ ]+ //g' filename
답변2
Bing AI에게 질문을 했습니다. 이것은 작동합니다 ...
You can use sed to remove the mode-flags and their options that start with -jigdo. Here’s an example command that should work:
sed 's/-jigdo[^ ]* [^ ]*//g' input.txt > output.txt
Copy
This command uses a regular expression to match any text that starts with -jigdo, followed by any number of characters that are not a space, followed by a space, and then any number of characters that are not a space. This will match the mode-flag and its option. The g at the end of the command tells sed to perform this replacement globally, i.e., for all occurrences in the input line.
You can replace input.txt with the name of the file containing the original line, and output.txt with the name of the file where you want to save the modified line. If you want to perform this operation in-place, i.e., modify the original file directly, you can use the -i option:
sed -i 's/-jigdo[^ ]* [^ ]*//g' input.txt
Copy
I hope this helps! Let me know if you have any questions or if there’s anything else I can do for you.
1
of
30
Like
Dislike
Copy
Export
How do I then clear any extra spaces between the mode-flags?
You can use another sed command to remove any extra spaces between the mode-flags. Here’s an example command that should work:
sed 's/ */ /g' input.txt > output.txt
Copy
This command uses a regular expression to match any sequence of one or more spaces and replaces it with a single space. The g at the end of the command tells sed to perform this replacement globally, i.e., for all occurrences in the input line.
You can replace input.txt with the name of the file containing the line with extra spaces, and output.txt with the name of the file where you want to save the modified line. If you want to perform this operation in-place, i.e., modify the original file directly, you can use the -i option:
sed -i 's/ */ /g' input.txt
Copy
You can combine this command with the previous one to remove the -jigdo mode-flags and their options, as well as any extra spaces between the remaining mode-flags, in a single command:
sed -i 's/-jigdo[^ ]* [^ ]*//g; s/ */ /g' input.txt
Copy
I hope this helps! Let me know if you have any questions or if there’s anything else I can do for you.