If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > using scripting language add a "*/" in a file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-04, 15:49
bunnyG bunnyG is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
using scripting language add a "*/" in a file

Please I need help. I want to add "*/" in a file. Here is an example of what i would like to achieve.

12345
6789
0987
654

I want to add "/*" at the start of 12345 and then add "*/" at the end of 0987.

I would apprecaite if anyone can help me out in this.
Reply With Quote
  #2 (permalink)  
Old 12-04-04, 16:14
fla5do fla5do is offline
Registered User
 
Join Date: Oct 2003
Location: Germany
Posts: 138
Hi bunnyG,
I do not know what you realy want.
I hope this solution can help you out



# using scripting language add a "*/" in a file


FO="dbforum12.org" #FILE_ORIGINAL
FN="dbforum12.new" #FILE_NEW

BS="12345" #BEGIN_STRING to add "/*"
ES="0987" #END_STRING to add "*/"

cat $FO | awk -v BS=$BS -v ES=$ES -v FN=$FN ' BEGIN { FS="@";OK=0 }
{
OK = 0
if ($1 == BS )
{
print "/*"$1 > FN
OK=1
}
if ($1 == ES )
{
print $1"*/" > FN
OK=1
}
if (OK == 0 )
{
print $1 > FN
}
}'
__________________
Greetings from germany
Peter F.
Reply With Quote
  #3 (permalink)  
Old 12-04-04, 23:10
bunnyG bunnyG is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
Thumbs up Thank you

Thank you Peter ,

A life saver, I will try this and will let you know. Thanks once again for the help

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On