Sponsored Content
Full Discussion: awk print in script
Top Forums Shell Programming and Scripting awk print in script Post 302976041 by Don Cragun on Wednesday 22nd of June 2016 09:41:23 PM
Old 06-22-2016
I readily believe the RudiC helped you create an awk program that could do something similar to what you are describing... But I can't believe that the code you have shown us does anything like what you are describing. (Shell variables are not expanded inside single-quoted strings. You are using code that changes data found in <value> tags and data found in <machine> tags, but your description doesn't say anything about changing data in <machine> tags.

And, since the code shown copies entire input files to corresponding output files (possibly after updating some text), I don't understand what additional text you are hoping to produce nor where you want that additional text to be written???

Please give us a much clearer description of what you are trying to do and show us small representative samples of an input file and the corresponding output file (or files) you hope to produce from that input. (And, be sure that the code that you have shown us does produce the output that you have indicated it currently produces.)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK script to print all the columns excpet the one specified

I have several columns by the name A B C D E...... and I want to print all the column other than column C and D. Could you please help me with the awk script? Thanks!! (3 Replies)
Discussion started by: kn.naresh
3 Replies

2. Shell Programming and Scripting

awk/shell script to print each line to a file

Dear People, My query is: have a file, which looks likes this: 10 20 30 40 50 1 2 3 4 5 100 200 300 400 500 what i need is: "PRINT EACH LINE TO AN UNIQUE FILE" desired output: file 1 10 20 30 40 50 file 2 1 2 3 4 5 (3 Replies)
Discussion started by: saint2006
3 Replies

3. Shell Programming and Scripting

awk script: print line number n of another file

Hi, I wrote an awk script to analyse file A. I call the script with files A and B. File A has lines like: 000000033100001 000000036100001 000000039100001 The first 9 characters are interpreted as a line number; for each line number found I want to output this line number of file B. ... (13 Replies)
Discussion started by: kpg
13 Replies

4. Shell Programming and Scripting

AWK Script - Print a column - within a Row Range

Hi, Please read the whole thread. I have been working on this script below. It works fine, feel free to copy and test with the INPUT File below as well. example: PACKET DATA PROTOCOL CONTEXT DATA APNID PDPADD EQOSID VPAA PDPCH PDPTY PDPID 10 ... (6 Replies)
Discussion started by: panapty
6 Replies

5. Shell Programming and Scripting

How to print backslash in shell script using awk?

I found that echo "aaa" | awk '{print ",\\";}' works, and it will give "\". but ddd=`echo "aaa" | awk '{print ",\\";}'`; echo $ddd will not work. Could anyone tell me why? thank you. (8 Replies)
Discussion started by: wxuyec
8 Replies

6. Fedora

Shell Script - awk, begin, for and print

pointsb=`awk -v a2="$a2" -v b2="$b2" -v c2="$c2" -v yb="$yb" -v yc="$yc" \ 'BEGIN { for (y=yc; y<=yb; y++) { x = a2*y*y+b2*y+c2; print x, y }; }'` I am learning shell script. I was reading a script and got confused in this line. I understood that awk is allowing to assign the variable. But... (10 Replies)
Discussion started by: agriz
10 Replies

7. Shell Programming and Scripting

awk script to search output for a value and print

GOODNUMBERS="1 2 3 4 5 6 3 3 34 34 5 66 12" BADNUMBERS="7 3 12 5 66" for eachnum in `echo ${GOODNUMBERS}` do echo ${BADNUMBERS} | gawk -v threshold=${eachnum} '$1 != threshold' done what im trying to do with the above is, i want to print numbers that are in the GOODNUMBERS... (10 Replies)
Discussion started by: SkySmart
10 Replies

8. Shell Programming and Scripting

awk script to match and print

I need a script that will search for a string from column 1 in file A and when the string matches the last column in file B, print columns 1, 2 (file A) and columns 2, 3 (file B). input file A stringtomatch1 a stringtomatch2 a stringtomatch3 b file B junkcolumn1 printcolumn2... (4 Replies)
Discussion started by: ncwxpanther
4 Replies

9. Shell Programming and Scripting

awk script to print file name

I have the following awk script that looks at the first 2 columns of multiple files and when they match, it prints the min of the 3rd column. for year in tave-{1950..2015}.txt do cat "$year" done | awk '{n=$3; $3=x} !($0 in A) || n<A {A=n} END{for(i in A) print i A}' > output.txt ... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

10. UNIX for Beginners Questions & Answers

awk script to match string and print status

Dear team, Need support to built awk script for below requirement Input file LOTC cluster state: ------------------- Node safNode=SC_2_1 joined cluster | Node safNode=SC_2_2 joined cluster | Node safNode=PL_2_3 fail cluster | AMF cluster state: ------------------... (16 Replies)
Discussion started by: shanul karim
16 Replies
exif(1) 						 command line front-end to libexif						   exif(1)

NAME
exif - shows EXIF information in JPEG files SYNOPSIS
exif [ OPTION ] [ file... ] DESCRIPTION
exif is a small command-line utility to show and change EXIF information in JPEG files. Most digital cameras produce EXIF files, which are JPEG files with extra tags that contain information about the image. The exif command- line utility allows you to read EXIF information from and write EXIF information to those files. exif internally uses the libexif library. Each input file given on the command line is acted upon in turn, using all the options given. Execution will be aborted immediately if one file is not readable or does not contain EXIF tags. As EXIF tags are read, any unknown ones are discarded and known ones are automatically converted into the correct format, if they aren't already. Corrupted MakerNote tags are also removed, but no format changes are made. OPTIONS
-v, --version Display the exif version number. -i, --ids Show ID numbers instead of tag names. -t, --tag=TAG Select only this TAG. TAG is the tag title, the short tag name, or the tag number (hexadecimal numbers are prefixed with 0x), from the IFD specified with --ifd. The tag title is dependent on the current locale, whereas name and number are locale-independent. --ifd=IFD Select a tag or tags from this IFD. Valid IFDs are "0", "1", "EXIF", "GPS", and "Interoperability". Defaults to "0". -l, --list-tags List all known EXIF tags and IFDs. A JPEG image must be provided, and those tags which appear in the file are shown with an aster- isk in the corresponding position in the list. -|, --show-mnote Show the contents of the MakerNote tag. The contents of this tag are nonstandard (and often undocumented) and may therefore not be recognized, or if they are recognized they may not necessarily be interpreted correctly. --remove Remove the tag or (if no tag is specified) the entire IFD. -s, --show-description Show description of tag. The --tag option must also be given. -e, --extract-thumbnail Extract the thumbnail, writing the thumbnail image to the file specified with --output. -r, --remove-thumbnail Remove the thumbnail from the image, writing the new image to the file specified with --output. -n, --insert-thumbnail=FILE Insert FILE as thumbnail. No attempt is made to ensure that the contents of FILE are in a valid thumbnail format. --no-fixup Do not attempt to fix EXIF specification violations when reading tags. When used in conjunction with --create-exif, this option inhibits the creation of the mandatory tags. exif will otherwise remove illegal or unknown tags, add some mandatory tags using default values, and change the data type of tags to match that required by the specification. -o, --output=FILE Write output image to FILE. If this option is not given and an image file must be written, the name used is the same as the input file with the suffix ".modified.jpeg". --set-value=VALUE Set the data for the tag specified with --tag and --ifd to VALUE. Compound values consisting of multiple components are separated with spaces. -c, --create-exif Create EXIF data if it does not exist. Mandatory tags are created with default values unless the --no-fixup option is given. This option can be used instead of specifying an input file name in most cases, to operate on the default values of the mandatory set of EXIF tags. In this case, the --output option has no effect and no file is written. -m, --machine-readable Produce output in a machine-readable (tab-delimited) format. The --xml-output and --machine-readable options are mutually exclu- sive. -w, --width=N Set the maximum width of the output to N characters (default 80). This does not apply to some output formats (e.g. XML). -x, --xml-output Produce output in an XML format (when possible). The --xml-output and --machine-readable options are mutually exclusive. -d, --debug Show debugging messages. Also, when processing a file that contains corrupted data, this option causes exif to attempt to continue processing. Normally, corrupted data causes an abort. Help options -?, --help Show help message. --usage Display brief usage message. EXAMPLES
Display all recognized EXIF tags in an image and the tag contents, with bad tags fixed: exif image.jpg Display a table listing all known EXIF tags and whether each one exists in the given image: exif --list-tags --no-fixup image.jpg Display details on all XResolution tags found in the given image: exif --tag=XResolution --no-fixup image.jpg Extract the thumbnail into the file thumbnail.jpg: exif --extract-thumbnail --output=thumbnail.jpg image.jpg Display a list of the numeric values of only the EXIF tags in the thumbnail IFD (IFD 1) and the tag values: exif --ids --ifd=1 --no-fixup image.jpg Display the meaning of tag 0x9209 in the "EXIF" IFD according to the EXIF specification: exif --show-description --ifd=EXIF --tag=0x9209 Add an Orientation tag with value "bottom - left" to an existing image: exif --output=new.jpg --ifd=0 --tag=0x0112 --set-value=4 --no-fixup image.jpg Add a YCbCr Sub-Sampling tag with value 2,1 (a.k.a YCbCr 4:2:2) to an existing image and fix the existing tags, if necessary: exif --output=new.jpg --tag=YCbCrSubSampling --ifd=0 --set-value='2 1' image.jpg List table with all known EXIF tags, highlighting mandatory ones: exif -cl AUTHOR
exif was written by Lutz Mueller <lutz@users.sourceforge.net> and numerous contributors. This man page is Copyright (C) 2002-2010 Thomas Pircher, Dan Fandrich and others. SEE ALSO
http://www.sourceforge.net/projects/libexif exif 0.6.20 2010-12-14 exif(1)
All times are GMT -4. The time now is 01:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy