Wednesday, February 20, 2019

ColdFusion POI:Row and updating

I was working with the POI custom tags from Ben Nadel and noticed that the tag was creating the rows rather than updating. Adding a get and check fixed the issue.
<!--- Try Getting the  row. --->
  <cfset VARIABLES.Row = VARIABLES.SheetTag.Sheet.getRow( JavaCast( "int", (VARIABLES.SheetTag.RowIndex - 1) ) )>

  <cfif ! StructKeyExists(VARIABLES, "Row")>
  <cfset VARIABLES.Row = VARIABLES.SheetTag.Sheet.CreateRow(
   JavaCast( "int", (VARIABLES.SheetTag.RowIndex - 1) )
   ) />
  </cfif>

Friday, February 8, 2019

KornShell: Replace spaces with underscores

A simple ksh that will replace a space with "_"


#!/bin/ksh
find /your/file/directory -type f -name "* *" | \
while read file; do \
newfile="$(echo "$file" | sed 's/ /_/g')"
mv "${file}" "${newfile}"
done