Results 1 to 2 of 2
I'm reading in a file with various table names, creating SQL to find a count of all the records in the table, then outputting both the table name and the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-20-2011 #1
- Join Date
- Apr 2007
Removing Space in File
The output file has the table name, a space, then the record count.
I do not want that space there, but for the life of me, I can't figure out how to make it go away. I'd prefer to have a delimiter like a comma or anything else.
Here's my wee code to read the input file and create the output file (TableCount is another script that does the counting):
while read line do RECORDCOUNT=`TableCount $var1 $var2 $var3 $line` echo "$line$RECORDCOUNT" >> $TABLECOUNTS done < $TABLELIST
while read line2 do echo $line2 | sed 's/ */\|/g' >> $TABLECOUNTS2 done < $TABLECOUNTS
- 09-21-2011 #2
In the segment you posted here, it looks like there is no space, but some sort of newline instead.
Fortunately, it's relatively easy to find out what character you actually have there by using the "od" command. Try the -a and -c flags.