Sponsored Content
Top Forums Shell Programming and Scripting fast search and replace in all files Post 302161750 by KevinADC on Friday 25th of January 2008 06:43:20 PM
Old 01-25-2008
works for me (Linux, not sure what version though) when I tested it with your sample data:

ABC|FGH|HJK|JKK;
BHJ|AAA|BBB|L
NNNN|JJJJ|LLLL;
JJJJJJ;
out put file consists of
ABC|FGH|HJK|JKK
BHJ|AAA|BBB|L NNNN|JJJJ|LLLL
JJJJJ

output:

ABC|FGH|HJK|JKK;
BHJ|AAA|BBB|LNNNN|JJJJ|LLLL;
JJJJJJ;
out put file consists ofABC|FGH|HJK|JKKBHJ|AAA|BBB|L NNNN|JJJJ|LLLLJJJJJ
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Fast way of find and replace, help

Hi All, I have nearly 200 files in a directory, each file is of nearly of 5000 lines. Each line of each file is having its 3rd field to be replaced by corresponding replace_string(2nd field of file1.out below). i.e. -Search the 3rd field of each line of each of 200 files in file1.out, get... (1 Reply)
Discussion started by: jkl_jkl
1 Replies

2. Shell Programming and Scripting

Search and Replace between two files

Hi all- I've got 2 files: One is the final results and one is a result set from a query. In the final results files I have placeholder strings in there that need to be replaced by the corresponding strings from the query file. So File#1 (FINAL RESULTS) LINEID CLIENT ID REP ... (1 Reply)
Discussion started by: Cailet
1 Replies

3. Shell Programming and Scripting

search and replace in many files

I have a directory full of files. Most of the code in the files is the same accept for a few parameter values. I want to remove hard coded values and replace it with a parameter that I can pass. This is oracle pl/sql anonymous blocks. so the code is similiar to this function myfunc (p_myvar ... (1 Reply)
Discussion started by: guessingo
1 Replies

4. Shell Programming and Scripting

Search and replace text in many files

Hello, I am very new to Linux and am trying to find a way for following problem. I have a number of files in a folder as Export000.dat, Export001.dat ..and so on. Each file has a string field 'Absolute velocity'. I want it to be replaced by 'Pixel shift' in all the files. I tried something like... (4 Replies)
Discussion started by: chirag.joshi
4 Replies

5. Shell Programming and Scripting

Search and replace string in files

I'm trying to remove the following string from several files. <img heigth="1" width="1" border="0" src="http://myteenmovies.net/t.php?id=5540372">I'm using the following script #!/bin/bash # This script will search and replace all regular files for a string # supplied by the user and... (1 Reply)
Discussion started by: d13g0sv
1 Replies

6. UNIX for Dummies Questions & Answers

Search and replace across files

Hi All, HP-UX oradev3 B.11.11 U 9000/800 3251073457 I have following files all contains text like "919642990137@". I need to search this text across all files and replace it with something like "919717298765@". I was wondering, how to accomplish this task? cpmprod_status.sh... (8 Replies)
Discussion started by: alok.behria
8 Replies

7. Programming

Search and replace in two different files

Hi there, i got the following problem. i need a bash script to correct e-mail addresses in an csv. i got a huge csv like this A B C D heiner.holber.somewhere.ch heiner holber heiner.holber@somewhere.ch So A is the wrong... (8 Replies)
Discussion started by: molker
8 Replies

8. Shell Programming and Scripting

Search and Replace in multiple files

Hello, I have hundreds of files in which I need to change email address. Here is what I am trying to do: 1. All text files are in a directory "a" 2. In the text file, I want to replace email address for preparer. All these lines start with {{PreparerEmail and end with }}. The email... (3 Replies)
Discussion started by: cartrider
3 Replies

9. Shell Programming and Scripting

Search replace with awk using 2 files

I have a bit of a complex problem that I would like to solve with awk. It is essentially a 2-part problem. I have a large directory of files with the same format, each with 266 lines. The first 206 lines of each file are filled with attribute information. Then the following 60 lines consist... (4 Replies)
Discussion started by: owwow14
4 Replies

10. UNIX for Dummies Questions & Answers

Search in one type of files and replace

I am not sure how to search and replace the word in the few specific files. I need to search and replace word in only the name containing pepsi in the filename. (12 Replies)
Discussion started by: ramkumar15
12 Replies
PMWEBAPI(3)						     Library Functions Manual						       PMWEBAPI(3)

NAME
PMWEBAPI - introduction to the Performance Metrics Web Application Programming Interface OVERVIEW
The PMWEBAPI interface is a binding of a subset of the PMAPI to the web. It uses HTTP as transport, REST as organizational style for request/parameter encoding (the GET and POST methods are interchangeable), and JSON as response encoding. A context identifier is used as a persistent way to refer to PMAPI contexts across related web requests. These context identifiers expire after a configurable period of disuse. Errors generally result in HTTP-level error responses. CONTEXT CREATION
: pmNewContext To create a new web context identifier, a web client invokes: /pmapi/context?local=ANYTHING Creates a PM_CONTEXT_LOCAL PMAPI context. /pmapi/context?hostname=STRING /pmapi/context?hostspec=STRING Creates a PM_CONTEXT_HOST PMAPI context with the given host name and/or extended specification. If the host specification contains a userid/password combination, then the corresponding pmapi context operations will require HTTP Basic authentication credentials with matching userid/password. /pmapi/context?archivefile=ARCHIVE Creates a PM_CONTEXT_ARCHIVE PMAPI context with the given file name. In addition, the web client may add the parameter &polltimeout=MMMM for a maximum interval (in seconds) between expected accesses to the given context. This value is limited by pmwebd configuration, and is a courtesy to allow pmwebd to free up memory earlier in case of sud- den web application shutdown. If successful, the response from these requests is a JSON document of the form: { "context" : NNNNN } The number (a 32-bit unsigned decimal) is then used in all later operations. PMAPI OPERATIONS
The general form of the requests is as follows: /pmapi/NNNNN/OPERATION where /pmapi is the fixed prefix for all PMWEBAPI operations, NNNNN is a PMWEBAPI context number returned from a context-creation call, or assigned permanently at pmwebd startup, and OPERATION?PARAM1=VALUE2&PARAM2=VALUE2 identifies the operation and its URL-encoded parameters. Some parameters may be optional. METRIC METADATA: pmLookupName, pmLookupDesc, pmTraversePMNS_r The general form of the requests is as follows: /pmapi/NNNNN/_metric Traverse the entire PMNS. /pmapi/NNNNN/_metric?prefix=NAME Traverse the subtree of PMNS with the prefix NAME. The response is a JSON document that provides the metric metadata as an array. For example: { "metrics": [ { "name":"foo.bar", "pmID":PPPP, "indom":DDDD, "type":"32", "sem":"instant", "units":"MHz", "text-oneline":"foo bar", "text-help":"blah blah blah" }, { "name":"foo.bar2", ... } ... ] } Most of the fields are self-explanatory. PPPP the PMID DDDD the instance domain type from pmTypeStr units from pmUnitsStr sem an abbreviation of the metric semantic: PM_SEM_COUNTER "counter" PM_SEM_INSTANT "instant" PM_SEM_DISCRETE "discrete" METRIC VALUE: pmFetch The general form of the requests is as follows: /pmapi/NNNNN/_fetch?names=NAME1,NAME2 Fetch current values for given named metrics. /pmapi/NNNNN/_fetch?pmids=PPPP1,PPPP2 Fetch current values for given PMIDs. The response is a JSON document that provides the values for all requested metrics, for all their instances. { "timestamp": { "s":SEC, "us":USEC }, "values": [ { "pmid":PPPP1, "name":"NAME1", "instances:" [ { "instance":IIII1, "value":VALUE1 } { "instance":IIII2, "value":VALUE2 } ... ] }, { "pmid":PPPP2, "name":"NAME2", ... } ... ] } Most of the fields are self-explanatory. Numeric metric types are represented as JSON integer or floating-point values. Strings are passed verbatim, except that non-ASCII values are replaced with a Unicode 0xFFFD REPLACEMENT CHARACTER code. Event type metrics are not currently supported. INSTANCE DOMAINS METADATA: pmGetInDom, pmNameInDom, pmLookupInDom The general form of the requests is as follows: /pmapi/NNNN/_indom?indom=DDDD List instances of the given instance domain. /pmapi/NNNN/_indom?name=NAME List instances of the instance domain belonging to the named metric. In addition, either query may be suffixed with: &instance=IIII,JJJJ Restrict listings to given instance code numbers. &iname=INAME1,INAME2 Restrict listings to given instance names. The response is a JSON document that provides the metric metadata as an array. For example: { "indom":DDDD, "instances": [ { "instance":IIII, "name":"INAME" } ... ] } INSTANCE PROFILE: pmAddProfile, pmDelProfile /pmapi/NNNN/_profile_reset? These are not currently supported. /pmapi/NNNN/_profile_reset?indom=DDDD These are not currently supported. /pmapi/NNNN/_profile_add?indom=DDDD&instance=IIII,JJJJ These are not currently supported. /pmapi/NNNN/_profile_add?indom=DDDD&iname=IIII,JJJJ These are not currently supported. /pmapi/NNNN/_profile_del?indom=DDDD&instance=JJJJ These are not currently supported. /pmapi/NNNN/_profile_del?indom=DDDD&iname=INAME1,INAME2 These are not currently supported. DERIVED METRICS: pmRegisterDerived /pmapi/NNNNN/_derive?name=NAME&expr=EXPRESSION These are not currently supported. CONTEXT COPY: pmDupContext /pmapi/NNNNN/copy These are not currently supported. CONTEXT CLOSE: pmDestroyContext /pmapi/NNNNN/destroy This is not likely to be supported, as it is destructive and would offer a tempting target to brute-force attackers. Instead, the pmwebd timeout is used to automatically free unused contexts. SEE ALSO
PCPIntro(1), PCPIntro(3), pmwebd(3), and PMAPI(3) Performance Co-Pilot PCP PMWEBAPI(3)
All times are GMT -4. The time now is 11:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy