Operating System - Linux
1826496 Members
2766 Online
109692 Solutions
New Discussion

Re: Removing Special characters

 
Ramanathan_2
Occasional Advisor

Removing Special characters

Hi,
My application guy is extracting a data file from a oracle database through informatica.This is a flat text file with 1lach records,I can see few special charaters in that file, can some one help me with a script in getting rid of those special character.
Sample file is attached , you can see the "$" when you say "set list" in the vi mode.

My output should be like the below for each recored in a single Line.
99167431|Web Server|5||1140004947|SIT webserver for P2P 7/22/05 Update - Support Contract (Metal Class): Bronze Transition Date: 1/1/05 Row: E 10 Rack Position: 30 # of Rack Units: 2 Server Environment: SIT San Connection: NO Data Center: WSIT
GLBA Data: NO |President and COO|Not Listed|0|KPLKY47|A358059|0|10.4.129.41|SIT.HOSTINGTEST.XYZ.NET|IBM|||Local|Network Backup|Delta Daily - Image Bi-Wkly|W2K3|Enterprise Server V-3.0|Chi,Mel|18233243|183243

9912367431|Web Server|5||11400dd04947|SIT webserver for P2P 7/22/05 Update - Support Contract (Metal Class): Bronze Transition Date: 1/1/05 Row: E 10 Rack Position: 30 # of Rack Units: 2 Server Environment: SIT San Connection: NO
Data Center: WSIT GLBA Data: NO |President and COO|Not Listed|0|KPLKY47|A358059|0|10.4.129.41|SIT.HOSTINGTEST.XYZ.NET|IBM|||Local|Network Backup|Delta Daily - Image Bi-Wkly|W2K3|Enterprise Server V-3.0|Chi,ana|143|1833

98983988|Desktop|3||1100535918|PC 300GL||||553642V|051177B|0|||IBM|Seat Count|||||||||

98980727|Desktop|3||1121873922|AT/AT COMPATIBLE||||1|1|0|||IBM||||||||Higginbotham,Gary M|u150672|U154392
.
.
.
.

Thanks in Addvance

Ram




7 REPLIES 7
Arunvijai_4
Honored Contributor

Re: Removing Special characters

Hi Ram,

Can you send your attachment in text file? I am not able to download .dat file. Also, you can achieve this by using "sed, awk or perl"

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Ramanathan_2
Occasional Advisor

Re: Removing Special characters

Attaching the file
Senthil Kumar .A_1
Honored Contributor

Re: Removing Special characters

Duplicate Thread,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1003806

Please close the duplicate.
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Muthukumar_5
Honored Contributor

Re: Removing Special characters

TRy like,

awk '{ if ( $0 ~ /Data Center/ ) { printf "\n"$0; } if ($0 ~ /Desktop/){ printf "\n"$0"\n"; } if ( $0 ~ /Desktop/ ) { printf "\n"$0; } else { printf; }}END{printf "\n"}'

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Removing Special characters

awk '{ if ( $0 ~ /Data Center/ ) { printf "\n"$0; } else if ($0 ~ /Desktop/) { printf "\n\n"$0"\n"; } else if ($0 ~ /Web Server/) { printf "\n\n"$0;} else { printf; }}END{printf "\n"}'

is fine.

--
Muthu


Easy to suggest when don't know about the problem!
Ramanathan_2
Occasional Advisor

Re: Removing Special characters

Thanks to all , We have used oracle Sqlplus commands to supress the special characters during extraction.
Ramanathan_2
Occasional Advisor

Re: Removing Special characters

Thanks to all , We have used oracle Sqlplus commands to supress the special characters during extraction.