Re: [ilugd]: Remove '\015' from all files in dir.

2002-08-01 Thread Amol Rao

--- Sandip Bhattacharya [EMAIL PROTECTED] wrote:
 a) for x in dir/*; do dos2unix $x ; done
 (Instead of dos2unix you can use your own
 commandline as yo had done 
 before)

Cool, but does not recurse through subdirectories !

 
 No. This is because the shell creates a different
 parallel process for 
 every command in the pipes of the command-line.
 Since they have all been 
 spawned from the shell at the same time, a variable
 in environment of one 
 of the process is not available in a parallel
 process.
 

Do I have four bash programs in memory there ?

__
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

  
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject 
header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org




Re: [ilugd]: Remove '\015' from all files in dir.

2002-08-01 Thread Sandip Bhattacharya

On Thu, Aug 01, 2002 at 02:36:31AM -0700, Amol Rao thundered from the skies thus:
 Thanks Sandip, 
 
  find dir/ -exec dos2unix {} \;
 I tried this but the code would not respond. Maybe
 dos2unix not getting arguments. Is it ? 

Try :
  find /usr/local -type f -exec wc -c {} \;

Should give you the file sizes of all files under /usr/local, after
recursion. Works on my system. IF this works, try replacing wc -c
with dos2unix, assuming you do have dos2unix in your system.

You can use the command perl -n -i -p  -e 's/\r//'  instead of
dos2unix. You do have perl on your system, don't you? ;) Also this
would be faster on your system

 One questions though : How does input is passed from
 one side of the pipe to the other if the commands are 
  executing in two different shells ?

Bash changes the standard input/output of each of the child processes
according to the pipe order. Check out APUE for more info/examples of
the same.

- Sandip

-- 
Sandip Bhattacharya
sandipb @ bigfoot.com
http://www.sandipb.net
---
Got some news from/for the Free(tm) world in India? Get to be a journo at
http://opennews.indianissues.org

  
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject 
header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org




[ilugd]: Remove '\015' from all files in dir.

2002-07-31 Thread Amol Rao

People,
1) cat dosFile | tr -d '\015'  unixFile removes
'\015' from dosfile and put it in the unix file, can
anybody suggest me a similar way to do that on the
folder. No temp files please, I am gonna have some
really big folders.

2) And why does not variable exported in the same
command be available on the other side of pipe ? Like
in : 
find ./myDir | export fileInUse=`awk '{printf(%s,
$0)}' |  cat $fileInUse | tr -d '\015'  $fileInUse
...should recurse through each entry in the ./myDir
and remove '\015' from each of $fileInUse. No export
possible here. I am trying it on bash. I am thinking
of having a alias like removeControlMFromFolder
folderName. Any clues ? Anybody ?

Cheers,
Amol.

__
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

  
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject 
header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org