Urgent: How to eliminate special symbols in a file and how to read it


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Urgent: How to eliminate special symbols in a file and how to read it
# 1  
Old 04-24-2008
Urgent: How to eliminate special symbols in a file and how to read it

Hi,

I have file called suppliersList.txt
---------------------------------
112|MIMUS|krish@google.com
113|MIMIRE|krish@google.com
114|MIMCHN|krish@google.com
115|CEL|krish@google.com
108|UGEN|krishn@google.com
109|SLAND|krish@google.com


i have 3 varibale
-------------
no
Name
email

i need to cut the special symbol from the file "|"
and i need to loop

my output should be like this

echo "No"$no
echo "Name"$Name
echo "email"$email

output like
---------------------

No 112
Name MIMUS
email krish@google.com

No 113
Name MIMIRE
email krish@google.com

No 114
Name MIMCHN
email krish@google.com

No 115
Name CEL
email krish@google.com

like this


Please send me your valuable suggesions on this

Thanks you everyone.

Thanks
Krish.
# 2  
Old 04-24-2008
cat suppliersList.txt

112|MIMUS|krish@google.com
113|MIMIRE|krish@google.com
114|MIMCHN|krish@google.com
115|CEL|krish@google.com
108|UGEN|krishn@google.com
109|SLAND|krish@google.com

Script is

awk -F"|" ' BEGIN {OFS="\n"}
{print "No " $1 , "Name " $2 ,"email " $3 , "\n" }' suppliersList.txt



No 112
Name MIMUS
email krish@google.com


No 113
Name MIMIRE
email krish@google.com


No 114
Name MIMCHN
email krish@google.com


No 115
Name CEL
email krish@google.com


No 108
Name UGEN
email krishn@google.com


No 109
Name SLAND
email krish@google.com
# 3  
Old 04-24-2008
Code:
awk -F"|"  '{print "\nNo " $1, "\nName " $2, "\nEmail " $3}' suppliersList.txt

# 4  
Old 04-24-2008
Thank you a lotttttttttttttttttttt
Its working fineeeeeeeeeeeeee
# 5  
Old 04-24-2008
Urgent: How to eliminate special symbols in a file and how to read it

Hi,

I need some more, advanced, i need to put in loop,
bcoz i need to validate these numbers with other string

i need to print how many lines in a file
i need to print

line1


NO
Name
Email


line2

No
Name
Email

like this
please help me
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Count special symbols between each unit

Can anybody help me figure this out? Thank you in advance. I have a input file. It shows like this: Query= random content random content > random content random content > random content > random content Query= random content random content random content > random content > random... (1 Reply)
Discussion started by: yuejian
1 Replies

2. UNIX for Dummies Questions & Answers

Eliminate Header and footer from EBCDIC file

Is there any command to eliminate Header and footer from EBCDIC file (4 Replies)
Discussion started by: abhilashnair
4 Replies

3. Shell Programming and Scripting

Extra symbols when vi a file

When i try to vi a file, see some extra characters "l^H^@^@^@^@^F^@"...but when i cat the same file i am not seeing this...How do i remove this??? (4 Replies)
Discussion started by: problemchild
4 Replies

4. Shell Programming and Scripting

Read file and remove special characters or strings

Hello all I am getting data like col1 | col2 | col3 asdafa | asdfasfa | asf*&^sgê 345./ |sdfasd23425^%^&^ | sdfsa23 êsfsfd | sf(* | sdfsasf My requirement is like I have to to read the file and remove all special characters and hex characters ranging form 00-1f from 1st column, remove %"'... (1 Reply)
Discussion started by: vasuarjula
1 Replies

5. Shell Programming and Scripting

Unable to read special character from the file

Hello All, We are getting files from sftp server through file transmission protocol & after transmission we are removing all the control M (^M) characters from them.we are expecting various kind of special characters in the files. we are tried removing '^M' characters through 'dos2unix' command... (2 Replies)
Discussion started by: Aquilis
2 Replies

6. Shell Programming and Scripting

eliminate pathname from the file name in the o/p

Hi, Im finding some files form a specific path and den writing those files to another file as: find /SYS/admin/data/xml -name '*.xml' -type f ! -newer file1 -print >>out.xml and when im doing cat out.xml im getting like dis: ... (2 Replies)
Discussion started by: ss_ss
2 Replies

7. Solaris

Special symbols in shell scripting

I am new to unix shell scripting, i was going through the existing shell scripts but couldn't able to get enough information on below syntaxes,i mean the symbols $# & $? used in the if loop. what exactly are they? what is the inline meaning, Could you please throw some light. Examples: 1) ... (4 Replies)
Discussion started by: Ariean
4 Replies

8. UNIX for Advanced & Expert Users

How to read an Xml record contained in a file--urgent

Hi I have an xml file which has multiple xml records.. I don't know how to read those records and pipe them to another shell command the file is like <abc>z<def>y<ghi>x........</ghi></def></abc> (1st record) <jkl>z<mno>y<pqr>x........</pqr></mno></jkl> (2nd record) Each record end... (4 Replies)
Discussion started by: aixjadoo
4 Replies

9. HP-UX

special character on Filename.. help!!!urgent

I'm trying to rename a file name but the original file has a special character caused by typo. I've tried numerous combination of characters but the file name (original) is still not being recognized which in turn, would not allow me to rename the file. Can someone help? The filename is a... (1 Reply)
Discussion started by: genzbeat
1 Replies

10. Shell Programming and Scripting

Urgent!!!Read directory from a file

I have a receive script file which had lots of direcorties to process,but now,I don't want to hardcode them,I need input the directory name in a Property.txt file,then write shell code to read the directory name from Property.txt to the script file so I can get flexible on it.But when I ran the sh... (3 Replies)
Discussion started by: joshuaduan
3 Replies
Login or Register to Ask a Question