Artwork

A tartalmat a HPR Volunteer and Hacker Public Radio biztosítja. Az összes podcast-tartalmat, beleértve az epizódokat, grafikákat és podcast-leírásokat, közvetlenül a HPR Volunteer and Hacker Public Radio vagy a podcast platform partnere tölti fel és biztosítja. Ha úgy gondolja, hogy valaki az Ön engedélye nélkül használja fel a szerzői joggal védett művét, kövesse az itt leírt folyamatot https://hu.player.fm/legal.
Player FM - Podcast alkalmazás
Lépjen offline állapotba az Player FM alkalmazással!

HPR4113: Today I Learnt, sed hold/pattern space use.

 
Megosztás
 

Fetch error

Hmmm there seems to be a problem fetching this series right now. Last successful fetch was on May 18, 2024 19:05 (1d ago)

What now? This series will be checked again in the next hour. If you believe it should be working, please verify the publisher's feed link below is valid and includes actual episode links. You can contact support to request the feed be immediately fetched.

Manage episode 417038881 series 108988
A tartalmat a HPR Volunteer and Hacker Public Radio biztosítja. Az összes podcast-tartalmat, beleértve az epizódokat, grafikákat és podcast-leírásokat, közvetlenül a HPR Volunteer and Hacker Public Radio vagy a podcast platform partnere tölti fel és biztosítja. Ha úgy gondolja, hogy valaki az Ön engedélye nélkül használja fel a szerzői joggal védett művét, kövesse az itt leírt folyamatot https://hu.player.fm/legal.

Today I Learnt, sed hold/pattern space use.

Sgoti talks about using sed hold/pattern spaces.

  • Tags: TIL, sed

I fixed the ${ls} /usr/bin to ${ls} ${bindir} issue mentioned in the show.

#!/bin/bash # License: GPL v3 # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . #Name: grab-bin.sh #Purpose: Link your binaries. #Version: beta 0.07 #Author: SGOTI (Some Guy On The Internet) #Date: 2023-12-17 #variables: bindir=/usr/bin/ awk=${bindir}awk cat=${bindir}cat chmod=${bindir}chmod date=${bindir}date echo=${bindir}echo find=${bindir}find ls=${bindir}ls mktemp=${bindir}mktemp sed=${bindir}sed uniq=${bindir}uniq #start: ${echo} -e "\nStep 0: $(${date} +%F), $(${date} +%T)"; # Create the /tmp/ directory to place the files. function mkt (){ if [ -d /tmp/$(${date} +%F).* ]; then tmpdir1=$(ls -d /tmp/$(${date} +%F).*) ${echo} -e "The directory already exists.\n${tmpdir1}" else tmpdir0=$(${mktemp} -d /tmp/$(${date} +%F).XXXXXXXX) tmpdir1=${tmpdir0} ${find} "${tmpdir1}" -type d -exec ${chmod} -R =700 {} +; ${echo} "Had to create ${tmpdir1}" fi } mkt ${echo} -e "\nStep 1: $(${date} +%F), $(${date} +%T)"; # Files created by this script. tmpdoc0=${tmpdir1}/$(${date} +%Y%m%d)variables.txt tmpdoc1=${tmpdir1}/$(${date} +%Y%m%d)bash.vim tmpdoc2=${tmpdir1}/$(${date} +%Y%m%d)sed-script.sed # Here-document to build the first document (variables.txt). ${cat} > ${tmpdoc0} << "EOL0" bindir=/usr/bin/ EOL0 # variables.txt body. ${ls} -1 ${bindir} | ${sed} -n ' h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/1=${bindir}2/p ' >> ${tmpdoc0} ${sed} -i '/[/d' ${tmpdoc0} ${echo} -e "\nStep 2: $(${date} +%F), $(${date} +%T)"; # Bash.vim here-document. ${cat} > ${tmpdoc1} << "EOL1" iabbr case; case ${var_name} in [yY]) ${echo} 'User said, "Yes"'; ;; [nN]) ${echo} 'User said, "No"'; ;; [qQ]) ${echo} "Let's get outta here."; exit ;; *) ${echo} "Good Heavens! Someone broke the script I'm writing."; exit ;; esac iabbr here; ${cat} << _EOD__EOD_2k0 iabbr func function NAME () {} iabbr if; if []; thenIelse${echo} "Good Heavens!"Ifi4k0A iabbr ali; alias NAME=''B iabbr ; () EOL1 # bash.vim body. ${ls} -1 ${bindir} | ${sed} -n ' { h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/iabbr 1 ${2}/p } ' >> ${tmpdoc1} # Bash.vim here-document second pass. ${cat} >> ${tmpdoc1} << EOL1-5 iabbr vars; bindir=/usr/bin/ EOL1-5 # bash.vim body second pass. ${ls} -1 ${bindir} | ${sed} -n ' { h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/\1=${bindir}2/p } ' >> ${tmpdoc1} ${sed} -i '/{[}/d; /${bindir}[/d' ${tmpdoc1} ${echo} -e "\nStep 3: $(${date} +%F), $(${date} +%T)"; # Sed script here-document. ${cat} > ${tmpdoc2} << "EOL2" #!/usr/bin/sed -f EOL2 # Sed script body. ${ls} -1 ${bindir} | ${sed} -n ' h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/s/\<2\>/${1}/g/p ' >> ${tmpdoc2} ${sed} -i '/[/d' ${tmpdoc2} ${find} "${tmpdir1}" -type d -exec chmod -R =700 {} +; ${find} "${tmpdir1}" -type f -exec chmod -R =600 {} +; ${echo} -e "\nStep 4: $(${date} +%F), $(${date} +%T)"; exit; 

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

  continue reading

4120 epizódok

Artwork
iconMegosztás
 

Fetch error

Hmmm there seems to be a problem fetching this series right now. Last successful fetch was on May 18, 2024 19:05 (1d ago)

What now? This series will be checked again in the next hour. If you believe it should be working, please verify the publisher's feed link below is valid and includes actual episode links. You can contact support to request the feed be immediately fetched.

Manage episode 417038881 series 108988
A tartalmat a HPR Volunteer and Hacker Public Radio biztosítja. Az összes podcast-tartalmat, beleértve az epizódokat, grafikákat és podcast-leírásokat, közvetlenül a HPR Volunteer and Hacker Public Radio vagy a podcast platform partnere tölti fel és biztosítja. Ha úgy gondolja, hogy valaki az Ön engedélye nélkül használja fel a szerzői joggal védett művét, kövesse az itt leírt folyamatot https://hu.player.fm/legal.

Today I Learnt, sed hold/pattern space use.

Sgoti talks about using sed hold/pattern spaces.

  • Tags: TIL, sed

I fixed the ${ls} /usr/bin to ${ls} ${bindir} issue mentioned in the show.

#!/bin/bash # License: GPL v3 # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . #Name: grab-bin.sh #Purpose: Link your binaries. #Version: beta 0.07 #Author: SGOTI (Some Guy On The Internet) #Date: 2023-12-17 #variables: bindir=/usr/bin/ awk=${bindir}awk cat=${bindir}cat chmod=${bindir}chmod date=${bindir}date echo=${bindir}echo find=${bindir}find ls=${bindir}ls mktemp=${bindir}mktemp sed=${bindir}sed uniq=${bindir}uniq #start: ${echo} -e "\nStep 0: $(${date} +%F), $(${date} +%T)"; # Create the /tmp/ directory to place the files. function mkt (){ if [ -d /tmp/$(${date} +%F).* ]; then tmpdir1=$(ls -d /tmp/$(${date} +%F).*) ${echo} -e "The directory already exists.\n${tmpdir1}" else tmpdir0=$(${mktemp} -d /tmp/$(${date} +%F).XXXXXXXX) tmpdir1=${tmpdir0} ${find} "${tmpdir1}" -type d -exec ${chmod} -R =700 {} +; ${echo} "Had to create ${tmpdir1}" fi } mkt ${echo} -e "\nStep 1: $(${date} +%F), $(${date} +%T)"; # Files created by this script. tmpdoc0=${tmpdir1}/$(${date} +%Y%m%d)variables.txt tmpdoc1=${tmpdir1}/$(${date} +%Y%m%d)bash.vim tmpdoc2=${tmpdir1}/$(${date} +%Y%m%d)sed-script.sed # Here-document to build the first document (variables.txt). ${cat} > ${tmpdoc0} << "EOL0" bindir=/usr/bin/ EOL0 # variables.txt body. ${ls} -1 ${bindir} | ${sed} -n ' h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/1=${bindir}2/p ' >> ${tmpdoc0} ${sed} -i '/[/d' ${tmpdoc0} ${echo} -e "\nStep 2: $(${date} +%F), $(${date} +%T)"; # Bash.vim here-document. ${cat} > ${tmpdoc1} << "EOL1" iabbr case; case ${var_name} in [yY]) ${echo} 'User said, "Yes"'; ;; [nN]) ${echo} 'User said, "No"'; ;; [qQ]) ${echo} "Let's get outta here."; exit ;; *) ${echo} "Good Heavens! Someone broke the script I'm writing."; exit ;; esac iabbr here; ${cat} << _EOD__EOD_2k0 iabbr func function NAME () {} iabbr if; if []; thenIelse${echo} "Good Heavens!"Ifi4k0A iabbr ali; alias NAME=''B iabbr ; () EOL1 # bash.vim body. ${ls} -1 ${bindir} | ${sed} -n ' { h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/iabbr 1 ${2}/p } ' >> ${tmpdoc1} # Bash.vim here-document second pass. ${cat} >> ${tmpdoc1} << EOL1-5 iabbr vars; bindir=/usr/bin/ EOL1-5 # bash.vim body second pass. ${ls} -1 ${bindir} | ${sed} -n ' { h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/\1=${bindir}2/p } ' >> ${tmpdoc1} ${sed} -i '/{[}/d; /${bindir}[/d' ${tmpdoc1} ${echo} -e "\nStep 3: $(${date} +%F), $(${date} +%T)"; # Sed script here-document. ${cat} > ${tmpdoc2} << "EOL2" #!/usr/bin/sed -f EOL2 # Sed script body. ${ls} -1 ${bindir} | ${sed} -n ' h s/[^0-9a-zA-Z]//g G s/\n/ / s/(.*) (.*)/s/\<2\>/${1}/g/p ' >> ${tmpdoc2} ${sed} -i '/[/d' ${tmpdoc2} ${find} "${tmpdir1}" -type d -exec chmod -R =700 {} +; ${find} "${tmpdir1}" -type f -exec chmod -R =600 {} +; ${echo} -e "\nStep 4: $(${date} +%F), $(${date} +%T)"; exit; 

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

  continue reading

4120 epizódok

All episodes

×
 
Loading …

Üdvözlünk a Player FM-nél!

A Player FM lejátszó az internetet böngészi a kiváló minőségű podcastok után, hogy ön élvezhesse azokat. Ez a legjobb podcast-alkalmazás, Androidon, iPhone-on és a weben is működik. Jelentkezzen be az feliratkozások szinkronizálásához az eszközök között.

 

Gyors referencia kézikönyv