Sponsored Content
Full Discussion: perl line needing a tweak
Top Forums Shell Programming and Scripting perl line needing a tweak Post 302649655 by Chubler_XL on Thursday 31st of May 2012 11:58:00 PM
Old 06-01-2012
Sorry based criteria for the 2nd last digit of IP address on original string. If your happy with "x" in 10.8.x.x to be any string of numbers then try this:

Code:
perl -aF, -ne 'printf "conf zone %2\$s delete host %s,,,$F[3]\n",split/\./,$F[1],2 if /^hostrecord/ &&/\b10\.([89]|1[01234])\.\d+\.\d+/' hosts.csv

This User Gave Thanks to Chubler_XL For This Post:
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needing a line feed for windows app

I wrote a program to format data with awk. This file will goto a windows machine and loaded into a windows app. The vendor said adding a line feed would help, but it would work as is. I am already doing a /n, will putting on the /r give the windows person what he wants. Thanks. (5 Replies)
Discussion started by: benefactr
5 Replies

2. UNIX for Dummies Questions & Answers

Intern needing to convert bash to perl.

Hello All. I am very new to Linux and I am currently interning. I have been working on a project for a week and I have had no success. I have to convert bash shell into perl to decrypt and store files. Here is the code in Linux and Bash. Any help would be greatly appreciated. $... (0 Replies)
Discussion started by: freak
0 Replies

3. Shell Programming and Scripting

How to tweak up

I have a script like this: while read abbrev; do sed 's/'$(echo "$abbrev" | tr "" "")'/'"$abbrev"'/g' 'output_rgt.'$$ >'tmp.'$$ mv 'tmp.'$$ 'output_rgt.'$$ done<'dict.shortcuts.'$$ And I don't know how to leave "mv" out. ('dict.shortcuts.'$$ may be... (14 Replies)
Discussion started by: MartyIX
14 Replies

4. Shell Programming and Scripting

Needing to wait for a line on screen and then give input repeatedly

So I have a weird question for my unix shell script. I wrote a shell script that does several things, but one of the things it does is call an executable. The executable then proceeds to start asking me questions, which it won't proceed until an input is entered. The answer to the questions is... (4 Replies)
Discussion started by: HelpMeProgram
4 Replies

5. Shell Programming and Scripting

SED script needs tweak

I have a SED script that has worked for years, but broke today due to a new variable in a remote file. This is the part of the script that now won't work: sed "s|/directory/overview.gif|/directory/img/overview2.gif|g" | \ The path /directory/overview.gif is no longer static as it had been... (2 Replies)
Discussion started by: dockline
2 Replies

6. Shell Programming and Scripting

Perl find command tweak

i use the following command to find files that were recently updated within the last hour: perl -MFile::Find -le' find { wanted => sub { -f and 3600 / 86400 >= -M and print $File::Find::name; } }, shift' /var/app/mydata/ this command works well. however, it seems to also search directories... (1 Reply)
Discussion started by: SkySmart
1 Replies

7. UNIX for Beginners Questions & Answers

Tar.gz help - Need to tweak

Hi Guys - I need help tweaking my tar.gz process. Currently, I compress all files in a directory, in which the parent directory is included in that. I only want to compress the "*.txt" files in the follow process: tar -zcvf ${_ESSB_TAR_PATH}/Essbase_Exports_${_DATETIMESTAMP}.tar.gz -C /... (3 Replies)
Discussion started by: SIMMS7400
3 Replies
PMPARSEHOSTSPEC(3)					     Library Functions Manual						PMPARSEHOSTSPEC(3)

NAME
__pmParseHostSpec, __pmUnparseHostSpec, __pmFreeHostSpec - uniform host specification parser C SYNOPSIS
#include <pcp/pmapi.h> #include <pcp/impl.h> int __pmParseHostSpec(const char *string, pmHostSpec **hostsp, int *count, char **errmsg); int __pmUnparseHostSpec(pmHostSpec *hosts, int count, char *string, size_t size); void __pmFreeHostSpec(pmHostSpec *hosts, int count); cc ... -lpcp DESCRIPTION
__pmParseHostSpec accepts a string specifying the location of a PCP performance metric collector daemon. The syntax of the various formats of this string is described in PCPIntro(1) where several examples are also presented. The syntax allows the initial pmcd(1) hostname to be optionally followed by a list of port numbers, which will be tried in order when con- necting to pmcd on that host. The portlist is separated from the hostname using a colon, and each port in the list is comma-separated. In addition, one or more optional pmproxy(1) hosts can be specified (currently, only one proxy host is supported by the PCP protocols). These are separated from each other and from the pmcd component using the @ character. These may also be followed by an optional port list, using the same comma-separated syntax as before. __pmParseHostSpec takes a null-terminated host specification string and returns an array of pmHostSpec structures, where the array has count entries. These pmHostSpec structures that are returned via hostsp represent each individual host in the specification string and has the following declaration: typedef struct { char *name; /* hostname (always valid) */ int *ports; /* array of host port numbers */ int nports; /* number of ports in host port array */ } pmHostSpec; __pmUnparseHostSpec performs the inverse operation, creating a string representation from a number of hosts structures. Where the count of structures indicated by hosts is greater than one, the proxy syntax is used to indicate a chain of proxied hosts. The size of the supplied string buffer must be provided by the caller using the size parameter. RETURN VALUE
If the given string is successfully parsed __pmParseHostSpec returns zero. In this case the dynamic storage allocated by __pmParseHostSpec can be released by calling __pmFreeHostSpec using the address returned from __pmParseHostSpec via hosts. __pmParseHostSpec returns PM_ERR_GENERIC and a dynamically allocated error message string in errmsg, if the given string does not parse, and the user-supplied errmsg pointer is non-null. Be sure to free(3C) the error message string in this situation. In the case of an error, hosts is undefined. In the case of success, errmsg is undefined. On success __pmUnparseHostSpec returns a positive value indicating the number of characters written into the supplied buffer. However, if the supplied buffer was too small, a negative status code of -E2BIG is returned. SEE ALSO
pmcd(1), pmproxy(1), pmchart(1), __pmParseHostAttrsSpec(3), PMAPI(3) and pmNewContext(3). Performance Co-Pilot PCP PMPARSEHOSTSPEC(3)
All times are GMT -4. The time now is 02:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy