Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Updating value based on search pattern Post 302818259 by nsuresh316 on Friday 7th of June 2013 08:10:44 AM
Old 06-07-2013
Updating value based on search pattern

I have a file with following data

Code:
<Field FieldName="CHCFA21_01_01" FieldType="Text">
        <Output CapturedValue="">
          <DataSource Name="" Value="" />
        </Output>
      </Field>
      <Field FieldName="CHCFA21_01_02" FieldType="Date">
        <Output CapturedValue="">
          <DataSource Name="" Value="" />
        </Output>
      </Field>
      <Field FieldName="CHCFA21_01_03" FieldType="Text">
        <Output CapturedValue="">
          <DataSource Name="" Value="" />
        </Output>
      </Field>
      <Field FieldName="CHCFA21_01_04" FieldType="Rate">
        <Output CapturedValue="">
          <DataSource Name="" Value="" />
        </Output>
</Field>

I need the output like this

Code:
<Field FieldName="CHCFA21_01_01" FieldType="Text">
        <Output CapturedValue="CHCFA21_01_011">
          <DataSource Name="" Value="" />
        </Output>
      </Field>
      <Field FieldName="CHCFA21_01_02" FieldType="Date">
        <Output CapturedValue="060713">
          <DataSource Name="" Value="" />
        </Output>
      </Field>
      <Field FieldName="CHCFA21_01_03" FieldType="Text">
        <Output CapturedValue="CHCFA21_01_031">
          <DataSource Name="" Value="" />
        </Output>
      </Field>
      <Field FieldName="CHCFA21_01_04" FieldType="Rate">
        <Output CapturedValue="125.20">
          <DataSource Name="" Value="" />
        </Output>
</Field>

Note :
If fieldtype is text use the value in fieldname tag, append with 1 and that value need to passed in Output CapturedValue tag
If fieldtype is date pass current date in MMDDYY format in Output CapturedValue tag
If fieldtype is rate pass any amount in Output CapturedValue tag in following format(for eg 125.20)

Code:
My OS Info : SunOS viper 5.9 Generic_117171-07 sun4u sparc SUNW,Sun-Fire-480R
My shell is csh

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search a pattern and if pattern found insert new pattern at the begining

I am trying to do some thing like this .. In a file , if pattern found insert new pattern at the begining of the line containing the pattern. example: in a file I have this. gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies

2. Shell Programming and Scripting

Print a pattern between the xml tags based on a search pattern

Hi all, I am trying to extract the values ( text between the xml tags) based on the Order Number. here is the sample input <?xml version="1.0" encoding="UTF-8"?> <NJCustomer> <Header> <MessageIdentifier>Y504173382</MessageIdentifier> ... (13 Replies)
Discussion started by: oky
13 Replies

3. Shell Programming and Scripting

Search and replace - pattern-based

Hey folks! I am new to shell-scripting, but I have a problem that I would like to solve using a script. I create very large html forms, used for randomized trials. In these forms, each question is supplied with a variable that looks something like this: PROJECT_formNN Where NN is the question... (1 Reply)
Discussion started by: Roevhat
1 Replies

4. Shell Programming and Scripting

Need one liner to search pattern and print everything expect 6 lines from where pattern match made

i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies

5. Shell Programming and Scripting

bash script to find date based on search string for continuesly updating file

Hi All, I am very new to UNIX and I have tried this for a longtime now and unable to crack it.... There is a file that is continuously updating. I need to search for the string and find the date @ which it updated every day..... eg: String is "work started" The log entry is as below: ... (1 Reply)
Discussion started by: Nithz
1 Replies

6. UNIX for Dummies Questions & Answers

Find next line based on pattern, if it is similar pattern skip it

Hi, I am able to get next line if it is matching a particular pattern. But i need a way to skip if next line also matches same pattern.. For example: No Records No Records Records found got it Records found Now i want to find 'Records found' after 'No Records' pattern matches.. ... (5 Replies)
Discussion started by: nagpa531
5 Replies

7. UNIX for Dummies Questions & Answers

Dynamically accept search pattern and display lines based on it

I have a output file which contains n number of document.Each document has n number of segments and identified using below points The starting segment is ISA and Ending segment is IEA Each document has unique number and it will be passed in REF*D9 segment Each line in sample file is called... (3 Replies)
Discussion started by: nsuresh316
3 Replies

8. Shell Programming and Scripting

Search for duplicates and delete but remain the first one based on a specific pattern

Hi all, I have been trying to delete duplicates based on a certain pattern but failed to make it works. There are more than 1 pattern which are duplicated but i just want to remove 1 pattern only and remain the rest. I cannot use awk '!x++' inputfile.txt or sed '/pattern/d' or use uniq and sort... (7 Replies)
Discussion started by: redse171
7 Replies

9. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies

10. Shell Programming and Scripting

Script to find string based on pattern and search for its corresponding rows in column

Experts, Need your support for this awk script. we have only one input file, all these column 1 and column 2 are in same file and have to do lookup for values in one file(column1 and column2) but output we need in another file Need to grep row whose string contains 9K from column 1. When found... (6 Replies)
Discussion started by: as7951
6 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 01:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy