Sponsored Content
Top Forums Shell Programming and Scripting Shell Script @ Find a key word and If the key word matches then replace next 7 lines only Post 302900332 by gull04 on Tuesday 6th of May 2014 09:28:53 AM
Old 05-06-2014
Hi Rajeev,

This is quick and dirty, but should work.

If your first file is called file01.xml and you put the contents of the second in something like file02.xml you can do the following.

Code:
sed -e '/<active>/,/<\/active>/d' file01.txt > out01.txt

Then you should be able to run the following command.

Code:
sed -e '/InventoryVisibility/ r file02.txt' < out01.txt > out02.txt

Once you have done that all you should have to do is move out02,txt to filename.xml - remember and keep copies of the originals.

This can probably be done in a single line of sed or awk, but I don't use it enough.

Regards

Gull04
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Searching for key word within a file

Hello, I have a directory that holds all of my matlab codes. I am trying to run a searh on all of the matlab files that have the word "while" written inside the sytax of the code. Looking for all of the times that I did a while loop. Can someone help me do this? Thanks in advance. ... (1 Reply)
Discussion started by: moradwan
1 Replies

2. Shell Programming and Scripting

search for key word and execute

Hi, I am writing a shell (after 6-7 months)that has to receive text from another shell, check if the first line in the text has a key word and then execute different shell.I could come up with the below program structure, please suggest me if there is a better way to do it or please help me with... (14 Replies)
Discussion started by: rider29
14 Replies

3. Shell Programming and Scripting

Help adding a key word search to my script

Hello: I need help adding a key word search to my bash script. I have the following script. My boss whats the user to be able to add a search word e.g. unknown failures for the script to search the logs through and find the instances. I had originally done it so it grepped for unknown... (8 Replies)
Discussion started by: taekwondo
8 Replies

4. Shell Programming and Scripting

key word parameter

cat shell_script.ksh x=$A y=$B export x export y echo $x echo $y when i am running this with a command ksh shell_script.ksh -A 10 -B 20 its not showing anything .... could you let me know how i can use key word type paramter (2 Replies)
Discussion started by: dr46014
2 Replies

5. Shell Programming and Scripting

perl (word by word check if a hash key)

Hi, Now i work in a code that 1-get data stored in the database in the form of hash table with a key field which is the " Name" 2-in the same time i open a txt file and loop through it word by word 3- which i have a problem in is that : I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies

6. Shell Programming and Scripting

print lines from a file containing key word

i have a file containing over 1 million records,and i want to print about 300,000 line containing a some specific words. file has content. eg 1,rrt,234 3,fgt,678 4,crf,456 5,cde,drt 6,cfg,123 and i want to print the line with the word fgt,crf this is just an example,my file is so... (2 Replies)
Discussion started by: tomjones
2 Replies

7. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

8. Homework & Coursework Questions

Tru to print the last name and first name using key word

I am new to shell scripting and trying to do the below Stan:Smith:Detroit:MI Jim:Jones:Farmington Hills:MI Jack:Frost:Denver:CO Sue:Apple:New York:NY Cindy:Thompson:Battle Creek:MI John:Smith:Denver:CO George:Jones:New York:NY Need to create a shell script This script will display the... (1 Reply)
Discussion started by: jakemathew
1 Replies

9. Shell Programming and Scripting

How do i replace a word ending with "key" using awk excpet for one word?

echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} | awk 'gsub(/^|abc,|$/,"") {print}' Required output {grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies

10. UNIX for Beginners Questions & Answers

How to search for a word in column header that fully matches the word not partially in awk?

I have a multicolumn text file with header in the first row like this The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach for ii in ${hdr} do gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
TABLIX(1)						       Tablix User's Manual							 TABLIX(1)

NAME
tablix2_plot - Tablix data plotter SYNOPSIS
tablix2_plot command [ options ] DESCRIPTION
Tablix is a powerful free software kernel for solving general timetabling problems. It uses a coarse-grained parallel genetic algorithm in combi- nation with other techniques to construct sensible timetables from XML formatted problem descriptions. Tablix can run on a single host as well as on a heterogeneous parallel virtual machine using PVM3. tablix2_plot can be used to plot various types of population convergence graphs using data in files usually named conv0.txt , conv1.txt , ... Tablix will save convergence data into these files if it was compiled with the --enable-conv option. These graphs can be useful for example to get a rough estimate of time required to solve a particular problem (note that tablix2_plot can be safely used with files that are still written to by a running Tablix session). Graphs are plotted with gnuplot using the default output terminal (which is in most cases a X11 display). Encapsulated postscript files can be obtained by setting EPSOUTPUT environment variable. Scalable vector graphics files can be obtained by setting SVGOUTPUT environment variable. The contents of these variables are used by tablix2_plot as a file name to write to. OPTIONS
tablix2_plot --conv-fitness [ --scale SCALE ] [ PREFIX ] ... Plot population convergence graph using convergence data in files conv*.txt in the current directory. One line is drawn for each computing node. It shows the fitness value of the best timetable versus generation count. Use the PREFIX option, if you used the -o option with Tablix. You can use more than one PREFIX option to plot multiple convergence graphs in one window. Use the SCALE option to adjust the vertical scale. tablix2_plot --fit-fitness [ --scale SCALE ] [ PREFIX ] ... Same as --conv-fitness above, except that an exponential function is also drawn on the graph using least squares fitting. This can be used to get a rough estimate of the time required to find a solution. The SCALE parameter is used to adjust the horizontal scale in this case. tablix2_plot --functions [ --scale SCALE ] CONVFILE Plot the return value of each fitness function versus generation count. Return values of mandatory fitness functions are plotted with thicker lines. CONVFILE must be a file with Tablix population convergence data (usually named conv*.txt ). Use the SCALE option to adjust the vertical scale. EXAMPLES
If Tablix was started with the following command: tablix2 -o u1_ sample.xml then the following command plots the population convergence graph: tablix2_plot --conv-fitness u1_ Encapsulated postscript version of the same graph can be obtained with the following command in bash shell: EPSOUTPUT="graph.eps" tablix2_plot --conv-fitness u1_ To see which mandatory restriction is preventing Tablix from finding the solution, use the per module plot, possibly with a small vertical scale: tablix2_plot --functions --scale 100 u1_conv0.txt BUGS
In addition to gnuplot tablix2_plot utility depends on a number of common UNIX programs (mktemp, grep, sed, awk, ...) that may not be available on all systems. The script is not currently capable of properly detecting if any required programs are missing. AUTHOR
Tomaz Solc (tomaz.solc@tablix.org) SEE ALSO
tablix2(1), Tablix User's Manual, Tablix modules HOWTO, Tablix on Morphix HOWTO Tomaz Solc 2005-09-03 TABLIX(1)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy