I have searched all over the forums for a problem similar to mine. I have found many but i have not been able to get them to work for me unfortunately!
What i am attempting to do is to extract part of a string from a line in a file. This line appears multiple times in the file. Example file:
I have tried using
I expected this to remove all the information on a line apart from the AAA1234AA string. But it does not remove anything at all. Is there any way i extract the string only?
I'm quite inexperienced in unix scripting as you can probably tell. I'm on HP-UX.
Thanks
---------- Post updated at 11:44 AM ---------- Previous update was at 11:21 AM ----------
I have also tried
but this has not worked either.
but if i try
this brings back the desired result (but only relating to that specific string.
How do I extract 5th to 10th characters of string as given below stored in a shell variable.
"ab cd ef gh ij kl"
How is cut to be used on this?
Thanks for any help. (1 Reply)
Hi,
Need to extract a string from one file and search the same in other files.
Ex:
I have file1 of hundred lines with no delimiters not even space.
I have 3 more files.
I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
i want to cut all the entries from the /etc/passwd file in which the uid is> 500
for this i was writing this ,m quiet new to all this.. scripting
but on the 6th n 8th line ,, i hav to specify a line number .. to get the commnd working .. but i want to use variable i instead of that ,,... (2 Replies)
Hi All,
I am writing a shell script for which I am stuck with an extraction part.
I arrived till extraction of a path of file. Lets take an example.
I now have a file which contains following one line:
2348/home/userid/mydir/any_num_dir/myfile.text
Now I want to extract only... (2 Replies)
I am trying to extract a hyperlink from a html document using awk. I have managed to output in the format... href="index.html"> where i would like it just to output index.html. Any ideas on how i would do this?
Thanks (2 Replies)
Hi ,
I have input file and i want to extract below strings
<msisdn xmlns="">0492001956</ msisdn> => numaber inside brackets
<resCode>3000</resCode> => 3000 needs to be extracted
<resMessage>Request time
getBalances_PSM.c(37): d out</resMessage></ns2:getBalancesResponse> => the word... (14 Replies)
Hi All,
I am pretty new to pattern matching and extraction using shell scripting. Could anyone please help me in extracting the word matching a pattern from a line in bash.
Input Sample (can vary between any of the 3 samples below):
1) Adaptec SCSI RAID 5445
2) Adaptec SCSI 5445S RAID
3)... (8 Replies)
Hi,
I have a file which is an extract of jil codes of all autosys jobs in our server.
Sample jil code:
**************************
permission:gx,wx
date_conditions:yes
days_of_week:all
start_times:"05:00"
condition: notrunning(appDev#box#ProductLoad)... (1 Reply)
I have a string:
2015-04-16 07:30:05,625000 +0900 xxxx.com
I just want to extract the time from the above line I am using the below syntax
x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/
$time = $2 . ':' . $3 . ':' . $4;
print $time
But it is not working. Can some1 please help (2 Replies)
Hello.
First best wishes for everybody.
here is the input file ("$INPUT1") contents :
BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY;
BASH_FUNC_message_debug%%=() { local -a L_ARRAY;
BASH_FUNC_message_end_script%%=() { local -a L_ARRAY;
BASH_FUNC_message_error%%=() { local... (3 Replies)
Discussion started by: jcdole
3 Replies
LEARN ABOUT CENTOS
pmnsmerge
PMNSMERGE(1) General Commands Manual PMNSMERGE(1)NAME
pmnsmerge - merge multiple versions of a Performance Co-Pilot PMNS
SYNOPSIS
$PCP_BINADM_DIR/pmnsmerge [-adfv] infile [...] outfile
DESCRIPTION
pmnsmerge merges multiple instances of a Performance Metrics Name Space (PMNS), as used by the components of the Performance Co-Pilot
(PCP).
Each infile argument names a file that includes the root of a PMNS, of the form
root {
/* arbitrary stuff */
}
The order in which the infile files are processed is determined by the presence or absence of embedded control lines of the form #define
_DATESTAMP YYYYMMDD
Files without a control line are processed first and in the order they appear on the command line. The other files are then processed in
order of ascending _DATESTAMP.
The -a option suppresses the argument re-ordering and processes all files in the order they appear on the command line.
The merging proceeds by matching names in PMNS, only those new names in each PMNS are considered, and these are added after any existing
metrics with the longest possible matching prefix in their names. For example, merging these two input PMNS
root { root {
surprise 1:1:3
mine 1:1:1 mine 1:1:1
foo foo
yawn
yours 1:1:2
} }
foo { foo {
fumble 1:2:1
mumble 1:2:3
stumble 1:2:2 stumble 1:2:2
} }
yawn {
sleepy 1:3:1
}
Produces the resulting PMNS in out.
root {
mine 1:1:1
foo
yours 1:1:2
surprise 1:1:3
yawn
}
foo {
fumble 1:2:1
stumble 1:2:2
mumble 1:2:3
}
yawn {
sleepy 1:3:1
}
To avoid accidental over-writing of PMNS files, outfile is expected to not exist when pmnsmerge starts. The -f option forces the removal
of outfile (if it exists), before the check is made.
The -d option allows the resultant PMNS to optionally contain duplicate PMIDs with different names in the PMNS. By default this condition
is considered an error.
The -v option produces one line of diagnostic output as each infile is processed.
Once all of the merging has been completed, pmnsmerge will attempt to load the resultant namespace using pmLoadASCIINameSpace(3) - if this
fails for any reason, outfile will still be created, but pmnsmerge will report the problem and exit with non-zero status.
CAVEAT
Once the writing of the new outfile file has begun, the signals SIGINT, SIGHUP and SIGTERM will be ignored to protect the integrity of the
new file.
PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the
file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura-
tion file, as described in pcp.conf(5).
SEE ALSO pmnsadd(1), pmnsdel(1), pmLoadASCIINameSpace(3), pcp.conf(5), pcp.env(5) and pmns(5).
Performance Co-Pilot PCP PMNSMERGE(1)