2013-06-28

TSQL - Effect of database shrinking

Take a look at the effects of shrinking a random database in SQL server. This may not be completely conclusive, but perhaps a good example. In sum:

  • Index space unaffected
  • Data used space unaffected
  • The log practically disappears


Below are before and after screenshots.

Before:

After:

2013-06-09

Windows Powershell - Merge text files recursively, adding the name of each source file to each line in the consolidated file

Get-ChildItem -path C:\ORIGINAL_TEXT_FILES_FOLDER\n -recurse |?{ ! $_.PSIsContainer } |?{($_.name).contains(".txt")} | %{ Out-File -filepath C:\NEW_TEXT_FILE_PATH\CONSOLIDATED.txt -inputobject ($_.name + "|" + (get-content $_.fullname) + "`n" ) -Append}

Windows Powershell - How to combine multiple text files into one (recursive folder lookup)

Get-ChildItem -path C:\ORIGINAL_TEXT_FILES_IN_THIS_FOLDER\n -recurse |?{ ! $_.PSIsContainer } |?{($_.name).contains(".txt")} | %{ Out-File -filepath C:\NEW_CONSOLIDATED_FILE.txt -inputobject (get-content $_.fullname) -Append}

2013-06-08

Linux - Merge text flat files, adding the name of the source file to each line read


find . -type f | xargs -i echo {}|sed -r 's#(.\/)(.*)#cat &\|sed "s:^:\2,:g"#ge' > /home/USERNAME/Downloads/test.txt

Linux - How to replace white spaces in files, recursively

This statement will replace every blank space in a file name, with an underscore. For the folder you run it in, and also for files in any subfolders (any level).


find -name "* *" -type f | rename 's/ /_/g'