Hi All,
I have a script which takes multiple files from a UNIX server and renames them and put to a Unix folder.
Below is the script:
SrcDir=$1
cd $SrcDir
ls *_*.txt | nawk '
{x=$0;sub(/_.*\.txt$/,".txt",x); printf "cp %s /ap/test/cat/%s\n",$0,x}
' |sh -v
I am successfully moving all the files with renames.But I have an issue with the ^M to few files. I can see that source directory files are not having ^M. But when I run this script and copy the files , I can see that few files are having ^M's at the end.
I want all the files in one format(Unix format).
How can I come out of this problem...
Thanks in advance....
I have a script which takes multiple files from a UNIX server and renames them and put to a Unix folder.
Below is the script:
SrcDir=$1
cd $SrcDir
ls *_*.txt | nawk '
{x=$0;sub(/_.*\.txt$/,".txt",x); printf "cp %s /ap/test/cat/%s\n",$0,x}
' |sh -v
I am successfully moving all the files with renames.But I have an issue with the ^M to few files. I can see that source directory files are not having ^M. But when I run this script and copy the files , I can see that few files are having ^M's at the end.
I want all the files in one format(Unix format).
How can I come out of this problem...
Thanks in advance....