Sponsored Content
Top Forums Shell Programming and Scripting Need help in using sed/awk for line insertion in xml Post 302538654 by mirni on Wednesday 13th of July 2011 05:16:30 PM
Old 07-13-2011
Try this:
Code:
awk '
  NR==FNR{c[cnt++]=$1;next}
  /<num = /{gsub(/[0-9]+/,c[cnt2++],$0)}1' nums.txt file.xml

Note that it won't work correctly if you have multiple '<num =' tags in your xml file. It also requires that the num tag already contains some number. E.g. it won't fill anything into '<num = "">' tag.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parsing xml with awk/sed

Hi people!, I need extract from the file (test-file.txt) the values between <context> and </context> tag's , the total are 7 lines,but i can only get 5 or 2 lines!!:confused: Please look my code: #awk '/context/{flag=1} /\/context/{flag=0} !/context/{ if (flag==1) p rint $0; }'... (3 Replies)
Discussion started by: ricgamch
3 Replies

2. Shell Programming and Scripting

sed or awk to extract data from Xml file

Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result : mon titre 1;Createur1;Dossier1 mon titre 1;Createur1;Dossier1 and save it in cvs file (fichier.cvs). FROM this Xml file (test.xml): <playlist version="1"> <trackList> <track>... (1 Reply)
Discussion started by: yeclota
1 Replies

3. Shell Programming and Scripting

insertion of text from sed script

Hi , This is my first thread ; facing some issues withmy sed script I need to insert the code from my log file which is between two keywords. content is like this ........ log ############################ log1 log2 231 "Ban" "tom" and the line one of the cross line friend... (2 Replies)
Discussion started by: shalini_008
2 Replies

4. Shell Programming and Scripting

sed xml file multiple line replacement

I have a file called config.xml, it's a simple xml file, and I need use sed/awk to erase some lines. <machine xsi:type="unix-machineType"> <name>server1</name> <node-manager> <name>server1</name> <listen-address>server1</listen-address> </node-manager> ... (3 Replies)
Discussion started by: cbo0485
3 Replies

5. Shell Programming and Scripting

Using SED/AWK to extract xml at end of file

Hello everyone, Firstly i do not require alot of help.. i am right at the end of finishing my scipt but cannot find a solution to the last part. What i need to do is, prompt the user for a file to work with, which i have done. promt the user for an output file - which is done. #!/bin/bash... (14 Replies)
Discussion started by: hugh86
14 Replies

6. Shell Programming and Scripting

XML- Sed || Awk Bash script... Help!

Hi ! I'm working into my first bash script to make some xml modification and it's going to make me crazy lol .. so I decide to try into this forum to take some ideas from people that really know about this! This is my situation I've and xml file with a lots of positional values with another tags... (9 Replies)
Discussion started by: juampal
9 Replies

7. Shell Programming and Scripting

Text file insertion via sed

I have 800+ html files that need to have a javascript added to them in the head. I can do the looping, setting filenames as variables, etc. but I cannot figure out how to insert my javascript file into the html. My javascript is in a file named jsinsert.txt It basically has this format:... (4 Replies)
Discussion started by: Trapper
4 Replies

8. UNIX for Dummies Questions & Answers

xml to csv using sed and awk command

Hi Guys, Can you help me in creating shell script using sed,awk etc commands to generate csv file using xml file. (5 Replies)
Discussion started by: sbk
5 Replies

9. Shell Programming and Scripting

Awk/sed problem to write Db insertion statement

Hi There, I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB My exiting csv record... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

10. Shell Programming and Scripting

Modify xml using sed or awk

Hi All, I want to modify(changing the status from "on" to "off" status of Stage-element value from the below xml file using sed or awk: File Name: global.xml <?xml version="1.0" encoding="UTF-8"?> <config> <widget> <name>HTTP-POOL</name> <attributes> ... (5 Replies)
Discussion started by: wamqemail2
5 Replies
scsi_setup_cdb(9F)					   Kernel Functions for Drivers 					scsi_setup_cdb(9F)

NAME
scsi_setup_cdb - setup SCSI command descriptor block (CDB) SYNOPSIS
int scsi_setup_cdb(union scsi_cdb *cdbp, uchar_t cmd, uint_t addr, uint_t cnt, uint_t othr_cdb_data); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
cdbp Pointer to command descriptor block. cmd The first byte of the SCSI group 0, 1, 2, 4, or 5 CDB. addr Pointer to the location of the data. cnt Data transfer length in units defined by the SCSI device type. For sequential devices cnt is the number of bytes. For block devices, cnt is the number of blocks. othr_cdb_data Additional CDB data. DESCRIPTION
scsi_setup_cdb() function initializes a group 0, 1, 2, 4, or 5 type of command descriptor block pointed to by cdbp using cmd, addr, cnt, othr_cdb_data. addr should be set to 0 for commands having no addressing information (for example, group 0 READ command for sequential access devices). othr_cdb_data should be additional CDB data for Group 4 commands; otherwise, it should be set to 0. scsi_setup_cdb() function does not set the LUN bits in CDB[1] as the makecom(9F) functions do. Also, the fixed bit for sequential access device commands is not set. RETURN VALUES
scsi_setup_cdb() returns: 1 Upon success. 0 Upon failure. CONTEXT
These functions can be called from a user or interrupt context. SEE ALSO
makecom(9F), scsi_pkt(9S) Writing Device Drivers American National Standard Small Computer System Interface-2 (SCSI-2) American National Standard SCSI-3 Primary Commands (SPC) SunOS 5.10 23 Jun 1997 scsi_setup_cdb(9F)
All times are GMT -4. The time now is 07:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy