- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Adding a comma ( , ) in between of a line in DCL/V...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 03:35 AM
тАО12-17-2007 03:35 AM
ABED,HP1,XX,YY,XX,ZZ
ABRGELE,HP2,XX,YY,XX,ZZ
My file contains almost 1000 lines like this & I want to insert the comma(,) in the line after the second parameter. Can anybody guide me on this please.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 04:07 AM
тАО12-17-2007 04:07 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
there are probably a hundred different ways to do this.
I would use TPU and a LEARN sequence
FIND ,
CTRL-K ! Start LEARN sequence
FIND ! find next ,
FIND ! find next ,
, ! insert ,
KP0 ! goto start of next line
CTRL-R ! End LERARN sequence
F20 ! define F20 as learned key
Then hit F20 for each line in the file.
You may do: GOLD 1000 F20 as well.
Or you can write some DCL script, a Perl Script, a program etc.
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 04:35 AM
тАО12-17-2007 04:35 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 04:52 AM
тАО12-17-2007 04:52 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
$ perl -pe "s/,(.*?,)/,$1,/" old > new
s/x/y/ # substitute x with y
, #find a first comma
( #remember
.*? #anything, any number of times, non-greedy
) # stop remembering
replace by
,$1, # a comma, what was remembered, an an extra comma.
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 04:58 AM
тАО12-17-2007 04:58 AM
Solution$ open/read a INPUT_FILE
$ open/write b OUTPUT_FILE
$l:
$ read a line /end=end
$ outline = f$element (0 , "," , line)
$ i = 1
$l1:
$ el = f$element (i , "," , line)
$ if el.eqs."," then goto e1
$ outline = outline + "," + el
$ if i.eq.1 then outline = outline + ","
$ i = i + 1
$ goto l1
$e1:
$ write b outline
$ goto l
$end:
$ close a
$ close b
Replace INPUT_FILE and OUTPUT_FILE with yours file specifications.
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 05:13 AM
тАО12-17-2007 05:13 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
$ open/read a INPUT_FILE
$ open/write b OUTPUT_FILE
$l:
$ read a line /end=end
$ first = f$loc(",",line)
$ rest = f$extr(first,999,line)
$ second = first + f$loc(",",rest)
$ outline = f$extr(0,second,line) + "," + f$extr(second,999,line)
$ write b outline
$ goto l
$end:
$ close a
$ close b
I _might_ make that more robust by making sure the F$LOC functions find something less tan F$LEN. Or I might make sure the outline is one longer than the inline, but probably not.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 05:16 AM
тАО12-17-2007 05:16 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
Many thanks...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2007 12:49 AM
тАО12-18-2007 12:49 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
EDIT/TPU filename
1 - Press the DO button (or Shift and F6)
2 - Type REPLACE
3 - Type HP1
4 - Type HP1,
5 - Type A (for ALL)
You will find a comma appears after all HP1's.
Repeat steps 1 to 5 for HP2.
Done in seconds.
Regards Terry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2007 01:36 AM
тАО12-18-2007 01:36 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
my favorite for such problems is EDIT/EDT in command mode.
A file (say, HPCOMMA.EDT) with EDT commands:
s/HP1,/HP1,,/wh
s/HP2,/HP2,,/wh
exit
And now, whereever/whenever this needs to be done:
$ ....
$ EDITT/EDT infile /COMM=HPCOMMA.EDT
$...
After this, you have an extra version of infile, with the sesired substitution done.
Explanation:
s/ .../ xxx / wh
substitute ... by xxx over the whole file.
Should "/" be in the replcements, then use another character, eg "?" or "#" as separator.
EDITT/EDT notice the extra "T". Whenever a symbol EDIT does, or might, exist, then that extra last letter forces using the native command instead of any symbol substitution.
Limitations:
No line can exceed 255 chars.
No way (that I know of) to manipulate record separators.
hth
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2007 02:33 AM
тАО12-18-2007 02:33 AM
Re: Adding a comma ( , ) in between of a line in DCL/VMS script
Edit/edt should be fine.
$ edit/edt filename
*substi/HP2/HP2,/whole
This should take care of the whole.
Fox