SED - /10g

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers SED - /10g
# 1  
Old 01-28-2008
SED - /10g

I,m trying to delete the 10th and onwards occurrence of "," on each line, to remove embedded commas in an address field in csv files.

I have tried sed 's/,/ /10g' file > newfile, but this doesn't work (10 without the g removes the 10th occurrence. 10g is listed on some sites as an option.

I am using Solaris 2.5(?), and have tried with different shells.

Greatful for any help
# 2  
Old 01-28-2008
sed '10,$s/,//g' /tmp/111

Nagarajan G
# 3  
Old 01-28-2008
er - that will remove commas on lines 11-> end of file..not quite what OP was after...

This is messy, but should work:

 cat file | awk -F"," '{a[$NR]=$1;for (i=2;i<=10;i++){a[$NR]=a[$NR]","$i}for (i=11;i<=NF;i++){b[$NR]=b[$NR]" "$i}}{for  (i=1;i<=NR;i++){print a[$i],b[$i]}}'

# 4  
Old 01-28-2008
try sed.
command + output
 sed -f comma10.sed filename

 cat filename

cat comma10.sed
: startit
  t next1
  b last1
  : next1
  b startit
  : last1

# 5  
Old 01-29-2008

Thanks for your replies, very much appreciated. I'll let you know the results, but look promising.
# 6  
Old 01-29-2008
SED 10g

The second and third replies worked great. The second halted at 100 rows, but this could be due to the counters. I will have a play with the command.

Thanks again.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

What's the difference between Cisco SFP-10G-SR and XFP-10G-MM-SR ?

We're connecting a ASA 10G port with Cisco SFP-10G-SR transceiver to SCE 10G port with XFP-10G-MM-SR, can they connect each other? We also want to know what's the difference between them? (1 Reply)
Discussion started by: Ayaerlee
1 Replies

2. Solaris

need help in oracle upgrade from 10g to 11g

Hi , situation has come where in i want to upgrade my database from 10g to 11g ,my code heavily depends on Pro*C , i just want to know if i upgrade my DB from 10g to 11g , will there be any changes in my pro*c compiler ..? if so then wat are the prerequisites i need to check ..? thanks ... (2 Replies)
Discussion started by: senkerth
2 Replies

3. AIX

Oracle 10g on AIX7

Hi, anyone know if Oracle Database 10g is AIX 7 certified??? thanks in advance. Regards. Mario (2 Replies)
Discussion started by: Zio Bill
2 Replies

4. Programming

Oracle 10g tables dumps

HI All, I am using Oracle 10g . Want to take dumps(.dmp log) from many tables with where clause having same schema. ex : TB_MTH_ORA_CAB "WHERE TRUNC(dw_entry_dt )= TO_DATE('01-JAN-2011')" TB_AM_AT_OSS_MAT "WHERE TRUNC(dw_entry_date )>= TO_DATE('01-JAN-2011') AND TRUNC(dw_entry_date )<=... (4 Replies)
Discussion started by: Perlbaby
4 Replies

5. Solaris

How can i install oracle 10g on x86

Please guide me to install oracle 10g in x86 machine running solaris10. I tried the method that is distributed with the Oracle cd, but i finds it to be too complicated for me to complete. Please help. (2 Replies)
Discussion started by: Sesha
2 Replies

6. Solaris

Installing oracle 10g on solaris

Thanks all for your help. Now here is another problem i have, i have been trying to install oracle 10g on solaris but i keep getting this error message "there is not enough memory on the volume you specify to copy the starter database files the oracle universal installer discover that you have... (8 Replies)
Discussion started by: mutiat
8 Replies

7. AIX

oracle 10g on AIX 5

hi can anyone help me by telling step by stem oracle10g installation in AIX 5 . Munir mondolsoft Bangladesh (3 Replies)
Discussion started by: dbamunir
3 Replies

8. UNIX for Dummies Questions & Answers

Where is the .profile on Solaris 10G

Hi, I am trying to modifying the root user .profile file, but I cannot find it. If I do the command "echo $SHELL", i get /sbin/sh Where is the .profile located at? Sun's doc says the users home folder. I'm logged in as root, but when I go "/home", I don't see it :( Please help (9 Replies)
Discussion started by: annointed3
9 Replies

9. Red Hat

Help installing Oracle 9i/10g on RedHat?

If anybody can help would be greatly appreciated... I get the same error with Oracle 9i & 10g when installing on Red Hat Fedora 4, it's java related... Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2007-03-16_01-09PM/jre/lib/i386/ connat restore segment... (0 Replies)
Discussion started by: Joncamp
0 Replies

10. UNIX for Advanced & Expert Users

oracle 10g

I have download Oracle 10g for Solaris and I have configurate environment than I will start runInstaller and I have a messege that my version of solaris is not 5.7 , 5.8 and 5,9 I have 5.10 Solaris version what I shoud do I have download most actuall Oracle databases. (4 Replies)
Discussion started by: Deux
4 Replies
Login or Register to Ask a Question