Sponsored Content
Top Forums Shell Programming and Scripting sed command to remove a word from string Post 302742309 by pamu on Tuesday 11th of December 2012 12:56:27 AM
Old 12-11-2012
Quote:
Originally Posted by anand.shah

Code:
sed `s/\/\amp.cfg$//`

"`" won't work here....

try

Code:
find . -name amp.cfg | cut -c 3- | sed 's/\/amp.cfg$//'

This User Gave Thanks to pamu For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

2. Shell Programming and Scripting

remove newline between two string with sed command in unix shellscript

I have a file (test.dat) which contains data like this 459|199811047|a |b |shan kar|ooty| 460|199811047|a |bv |gur u|cbe| but I need it like: 459|199811047|a |b |shankar|ooty| 460|199811047|a |b |guru|cbe| While reading the data from this file, I don't want to remove newline from the end of... (4 Replies)
Discussion started by: jcrshankar
4 Replies

3. Shell Programming and Scripting

Using SED to extract a word or string.

I am working with the ksh shell in HP UNIX and I am attempting to extract a word, beginning with a particular string and ending at the first space. for example I want to extract the word or string MS_RECENT_ACTIVITY from the following string " This has been entered in MS_RECENT_ACTIVITY the... (2 Replies)
Discussion started by: simpletech369
2 Replies

4. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

5. Shell Programming and Scripting

Remove 1st word and _ from string

var=abc_cde_def_ghi_678.txt Expected output: cde_def_ghi_678.txt Is there a better way to achive this other than cut command? Basically, I need to remove the 1st word and _ from the string. Thanks. (1 Reply)
Discussion started by: vedanta
1 Replies

6. Shell Programming and Scripting

Remove last word of a string?

Hello I have a string that may or may not have 4 dots. The string is actualy a file within a folder, where multiple files are located. Files may look like: # ls * creds: 192.168.10.110 someserver shares: 192.168.10.110.Public someserver.sharefolder # I want to fill 2 variables,... (1 Reply)
Discussion started by: sea
1 Replies

7. Shell Programming and Scripting

Remove word with sed

How can I use sed or any utility to remove any word that begins with TRS-, I have tried sed 's/ERA.*//g' but seems not to be working Input: 23 TRS-458-9 345 235 45 TRS-42-5 423 000 76 300 234 Output: 23 345 235 45 423 000 76 300 234 (5 Replies)
Discussion started by: aydj
5 Replies

8. Shell Programming and Scripting

Remove string perl with first or last word is in a list

Hello, I try to delete all strings if their first or last word is one of this list of words : "the", "i", "in", "there", "this", "with", "on", "we", "that", "of" For example if i have this string in an input file "with me" this string will be removed, Example: input "the european... (2 Replies)
Discussion started by: cyrine
2 Replies

9. Shell Programming and Scripting

Bash - sed - Remove first word from line which can begin eventually with blank

hello. How to remove first word from line. The line may or may not start with blank. NEW_PARAM1=$(magic-command " -t --protocol=TCP -P 12345-u root -h localhost ") NEW_PARAM2=$(magic-command "-t --protocol=TCP -P 12345 -u root -h localhost ") I want NEW_PARAM1 equal to NEW_PARAM2 equal ... (2 Replies)
Discussion started by: jcdole
2 Replies

10. Shell Programming and Scripting

How to remove everything after a word containing string?

Hello, I wish to remove any word coming after searched string found in a word. source*.txt #!bin/bash #test1 http://www.aa.bb.cc http://www.xx.yy http://www.11.22.44 #test2 http://www.11.rr.cd http://www.01.yy http://www.yy.22.tt #test3 http://www.22.qq.fc http://www.0x.yy... (15 Replies)
Discussion started by: baris35
15 Replies
HOBBITGRAPH.CFG(5)						File Formats Manual						HOBBITGRAPH.CFG(5)

NAME
hobbitgraph.cfg - Configuration of the hobbitgraph CGI SYNOPSIS
$BBHOME/etc/hobbitgraph.cfg DESCRIPTION
hobbitgraph.cgi(1) uses the configuration file $BBHOME/etc/hobbitgraph.cfg to build graphs from the RRD files collected by Xymon. FILE FORMAT
Each definition of a graph type begins with a "[SERVICE]" indicator, this is the name passed as the "service" parameter to hobbit- graph.cgi(1). If the service name passed to hobbitgraph.cgi is not found, it will attempt to match the service name to a graph via the TEST2RRD environment variable. So calling hobbitgraph.cgi with "service=cpu" or "service=la" will end up producing the same graph. A graph definition needs to have a TITLE and a YAXIS setting. These are texts shown as the title of the graph, and the YAXIS heading respectively. (The X-axis is always time-based). If a fixed set of RRD files are used for the graph, you just write those in the RRDtool definitions. Note that Xymon keeps all RRD files for a host in a separate directory per host, so you need not worry about the hostname being part of the RRD filename. For graphs that use multiple RRD files as input, you specify a filename pattern in the FNPATTERN statement, and optionally a pattern of files to exclude from the graph with EXFNPATTERN (see "[tcp]" for an example). When FNPATTERN is used, you can use "@RRDFN@" in the RRD- tool definitions to pick up each filename. "@RRDIDX@" is an index (starting at 0) for each file in the set. "@RRDPARAM@" contains the first word extracted from the pattern of files (see e.g. "[memory]" how this is used). "@COLOR@" picks a new color for each graph automatically. The remainder of the lines in each definition are passed directly to the RRDtool rrd_graph() routine. The following is an example of how the "la" (cpu) graph is defined. This is a simple definition that uses a single RRD-file, la.rrd: [la] TITLE CPU Load YAXIS Load DEF:avg=la.rrd:la:AVERAGE CDEF:la=avg,100,/ AREA:la#00CC00:CPU Load Average GPRINT:la:LAST: %5.1lf (cur) GPRINT:la:MAX: %5.1lf (max) GPRINT:la:MIN: %5.1lf (min) GPRINT:la:AVERAGE: %5.1lf (avg) Here is an example of a graph that uses multiple RRD-files, determined automatically at run-time via the FNPATTERN setting. Note how it uses the @RRDIDX@ to define a unique RRD parameter per input-file, and the @COLOR@ and @RRDPARAM@ items to pick unique colors and a match- ing text for the graph legend: [disk] FNPATTERN disk(.*).rrd TITLE Disk Utilization YAXIS % Full DEF:p@RRDIDX@=@RRDFN@:pct:AVERAGE LINE2:p@RRDIDX@#@COLOR@:@RRDPARAM@ -u 100 -l 0 GPRINT:p@RRDIDX@:LAST: %5.1lf (cur) GPRINT:p@RRDIDX@:MAX: %5.1lf (max) GPRINT:p@RRDIDX@:MIN: %5.1lf (min) GPRINT:p@RRDIDX@:AVERAGE: %5.1lf (avg) ADVANCED GRAPH TITLES
Normally the title of a graph is a static text defined in the hobbitgraph.cfg file. However, there may be situations where you want to use different titles for the same type of graph, e.g. if you are incorporating RRD files from MRTG into Xymon. In that case you can setup the TITLE definition so that it runs a custom script to determine the graph title. Like this: TITLE exec:/usr/local/bin/graphitle The /usr/local/bin/graphtitle command is then called with the hostname, the graphtype, the period string, and all of the RRD files used as parameters. The script must generate one line of output, which is then used as the title of the graph. ENVIRONMENT
TEST2RRD Maps service names to graph definitions. NOTES
Most of the RRD graph definitions shipped with Xymon have been ported from the definitions in the larrd-grapher.cgi CGI from LARRD 0.43c. SEE ALSO
hobbitserver.cfg(5), rrdtool(1), rrdgraph(1) Xymon Version 4.2.3: 4 Feb 2009 HOBBITGRAPH.CFG(5)
All times are GMT -4. The time now is 02:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy