- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: same function with awk in unix
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
тАО02-15-2011 12:30 AM
тАО02-15-2011 12:30 AM
same function with awk in unix
What is same function of openvms with awk of unix?
In example;
#ls -l | awk '{print $1}'
How to use above function in openvms?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 03:33 AM - last edited on тАО09-19-2011 10:02 AM by Kevin_Paul
тАО02-15-2011 03:33 AM - last edited on тАО09-19-2011 10:02 AM by Kevin_Paul
Re: same function with awk in unix
Vpar,
welcome to the ITRC OpenVMS forum!
There is no direct equivalent of awk in OpenVMS, but depending upon your environment, you may be able to use other tools.
Try searching the OpenVMS forum for "awk".
useful results include:
http://h30499.www3.hp.com/t5/Languages-and-Scripting/KSH-to-DCL-command-question-easy/m-p/3742697#M2091
http://h30499.www3.hp.com/t5/Languages-and-Scripting/DCL-Search/m-p/3755839#M2204
http://h30499.www3.hp.com/t5/System-Management/awk-external-command-and-quotes/m-p/4008088#M17182
Here is a trivial sample command procedure showing how the DCL lexical function f$element could achieve a solution to your simple enquiry.
$ set nover
$ bash
ls -l >> fred.tmp
exit
$ open/read inp_fil fred.tmp
$ write sys$output "---- VMS style ----"
$loop1:
$ read/end=end_loop1 inp_fil inp_rec
$ write sys$output f$element(0," ",inp_rec)
$ goto loop1
$end_loop1:
$ close inp_fil
$ del/noconf/nolog fred.tmp.*
$!
$! or
$!
$unix_style:
$ write sys$output "---- Unix style ----"
$ bash
ls -l | awk '{print $1}'
exit
$ del/noconf/nolog fred.tmp.*
$exit
Of course, if you have GNV installed then you could simply write your own scripts using gawk.
Regards,
Duncan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 06:17 AM
тАО02-15-2011 06:17 AM
Re: same function with awk in unix
The best answer is probably that one would
not normally do anything like that in VMS
(DCL). If you're looking for file
permissions (called "protections" here), then
there are other, better ways to get them.
For example:
ALP $ write sys$output f$file_attributes( "login.com", "PRO")
SYSTEM=RWED, OWNER=RWED, GROUP=RE, WORLD=RE
Note that this is done entirely in DCL,
without running a program like "ls" or "awk".
VMS is not a UNIX(-like) operating system,
so the best way to do something in VMS is
often not the UNIX way.
Is there some actual problem which you are
trying to solve? As usual, it can be more
helpful to ask how to get a particular result
than it is to ask how to implement some
particular (sub-optimal) "solution".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2011 06:40 AM
тАО02-15-2011 06:40 AM
Re: same function with awk in unix
What is the read problem you are trying to solve here?
A) get awk to go? install gawk and be happy
B) get LS -L to go? switch into a gnv/bash environment
C) get particular file attributes like owner or protection in a script?
C1: Use DCL F$FILE lexical
C2: Check out PERL. All the Unix fstat file functions like -M for modification timer, or -s for size are there.
D) trying to print a first field on a line?
D1) as per Duncan... DCL Lexical F$ELEMENT (often on F$EDIT TRIM+COMPRESS pre-process)
D2) use standard PERL techiques.
Overall i suspect the answer is : use Perl !
Cheers,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2011 08:18 PM
тАО02-16-2011 08:18 PM
Re: same function with awk in unix
Thanks,
Hein