Skip to main content
quick fix
Source Link

For Qshell (qsh) inon IBMi, not bash as tagged by OP.

Limitations of qsh commands:

  • find does not have the -print0 option
  • xargs does not have -0 option
  • sed does not have -i option

Thus the solution in qsh:

  PATH='your/path/here'  SEARCH=\'subdomainA.example.com\'  REPLACE=\'subdomainB.example.com\' for file in $( find ${PATH} -P -type f ); do TEMP_FILE=${file}.${RANDOM}.temp_file if [ ! -e ${TEMP_FILE} ]; then touch -C 819 ${TEMP_FILE} sed -e 's/'$FRM_LIBRARY''$SEARCH'/'$TO_LIBRARY''$REPLACE'/g' \ < ${file} > ${TEMP_FILE} mv ${TEMP_FILE} ${file} fi done 

Caveats:

  • Solution excludes error handling
  • Not Bash as tagged by OP

For Qshell (qsh) in IBMi, not bash as tagged by OP.

Limitations of qsh commands:

  • find does not have the -print0 option
  • xargs does not have -0 option
  • sed does not have -i option

Thus the solution in qsh:

 for file in $( find ${PATH} -P -type f ); do TEMP_FILE=${file}.${RANDOM}.temp_file if [ ! -e ${TEMP_FILE} ]; then touch -C 819 ${TEMP_FILE} sed -e 's/'$FRM_LIBRARY'/'$TO_LIBRARY'/g' \ < ${file} > ${TEMP_FILE} mv ${TEMP_FILE} ${file} fi done 

Caveats:

  • Solution excludes error handling
  • Not Bash as tagged by OP

For Qshell (qsh) on IBMi, not bash as tagged by OP.

Limitations of qsh commands:

  • find does not have the -print0 option
  • xargs does not have -0 option
  • sed does not have -i option

Thus the solution in qsh:

  PATH='your/path/here'  SEARCH=\'subdomainA.example.com\'  REPLACE=\'subdomainB.example.com\' for file in $( find ${PATH} -P -type f ); do TEMP_FILE=${file}.${RANDOM}.temp_file if [ ! -e ${TEMP_FILE} ]; then touch -C 819 ${TEMP_FILE} sed -e 's/'$SEARCH'/'$REPLACE'/g' \ < ${file} > ${TEMP_FILE} mv ${TEMP_FILE} ${file} fi done 

Caveats:

  • Solution excludes error handling
  • Not Bash as tagged by OP
Source Link

For Qshell (qsh) in IBMi, not bash as tagged by OP.

Limitations of qsh commands:

  • find does not have the -print0 option
  • xargs does not have -0 option
  • sed does not have -i option

Thus the solution in qsh:

 for file in $( find ${PATH} -P -type f ); do TEMP_FILE=${file}.${RANDOM}.temp_file if [ ! -e ${TEMP_FILE} ]; then touch -C 819 ${TEMP_FILE} sed -e 's/'$FRM_LIBRARY'/'$TO_LIBRARY'/g' \ < ${file} > ${TEMP_FILE} mv ${TEMP_FILE} ${file} fi done 

Caveats:

  • Solution excludes error handling
  • Not Bash as tagged by OP