The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-25-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,748
This removes \N, replaces it with " "and then chops off the last character of each line and inserts a space there. Do you know about dos2unix (or dos2ux)?

Code:
find ./ -name "*.dmp" | xargs perl -pi -e 's/\\N/ /g; s/.$/ /g'
If you want it to run faster try using background processes:
Code:
cnt=0
find ./ -name "*.dmp" |\
while read file do
  perl -pi -e 's/\\N/ /g; s/.$/ /g'  $file  &
  cnt=$cnt+1
  z=$(( $cnt % 10 ))
  if [[ $z -eq 0 ]] ; then
     wait
  fi
done 
wait
This runs ten process at the same time in background. And then waits for completion. The code you proivided does not replace the characters with a space

Last edited by vgersh99; 01-25-2008 at 02:43 PM.. Reason: missing ']'