Sponsored Content
Top Forums Shell Programming and Scripting Assigning a specific format to a specific column in a text file using awk and printf Post 302417692 by goodbenito on Friday 30th of April 2010 09:25:34 AM
Old 04-30-2010
That was a perfect solution. Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert a text from a specific row into a specific column using SED or AWK

Hi, I am having trouble converting a text file. I have been working for this whole day now, still i couldn't make it. Here is how the text file looks: _______________________________________________________ DEVICE STATUS INFORMATION FOR LOCATION 1: OPER STATES: Disabled E:Enabled ... (5 Replies)
Discussion started by: Issemael
5 Replies

2. UNIX for Dummies Questions & Answers

AWK Command to find text in specific column

I'm new to scripting and would appreciate any help. I have a list of over 20 words in File1 that I need to find in columns 10-15 of File2. I need the entire row of File2 that the File1 list matches. I originally used a grep command which works, but provides File1 results that can be found... (3 Replies)
Discussion started by: Chillin
3 Replies

3. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

I have a text file in the following format: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 13402 NA07019... (3 Replies)
Discussion started by: evelibertine
3 Replies

4. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

Hi, I have a text file in the following format: Code: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 ... (2 Replies)
Discussion started by: evelibertine
2 Replies

5. UNIX for Dummies Questions & Answers

Use sed to replace but only in a specific column of the text file

Hi, I would like to use sed to replace NA to x ('s/NA/x/g'), but only in the 5th column of the space delimited text file, nowhere else. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

6. UNIX for Dummies Questions & Answers

Switching the values in a specific column of a text file

Hi, I have a space de-limited text file. In the fifth column, I would like to switch "1"s with "2"s. How do I go about doing that? Thanks! Sample input: 0 311000259 0 0 1 1 0 311000397 0 0 1 2 0 311000491 0 0 2 1 0 311000516 0 0 2 1 0 311000541 0 0 1 1 0 311000558 0 0 2 1 0 311000566 0... (1 Reply)
Discussion started by: evelibertine
1 Replies

7. UNIX for Dummies Questions & Answers

How to cut from a text file based on value of a specific column?

Hi, I have a tab delimited text file from which I want to cut out specific columns. If the second column equals one, I want to cut out columns 1 and 5 and 6. If the second column equals two, I want to cut out columns 1 and 5 and 7. How do I go about doing that? Thanks! (4 Replies)
Discussion started by: evelibertine
4 Replies

8. Shell Programming and Scripting

Converting text files to xls through awk script for specific data format

Dear Friends, I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls. The input is as follows: >gi|1234|ref| Query = 1 - 65, Target = 1677 - 1733 Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46 fd sdfsdfsdfsdf fsdfdsfdfdfdfdfdf... (6 Replies)
Discussion started by: Amit1
6 Replies

9. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies

10. Shell Programming and Scripting

Using awk to change a specific column and in a specific row

I am trying to change the number in bold to 2400 01,000300032,193631306,190619,0640,1,80,,2/ 02,193631306,000300032,1,190618,0640,CAD,2/ I'm not sure if sed or awk is the answer. I was going to use sed and do a character count up to that point, but that column directly before 0640 might... (8 Replies)
Discussion started by: juggernautjoee
8 Replies
gdcmimg(1)							       GDCM								gdcmimg(1)

NAME
gdcmimg - Manipulate DICOM image file. SYNOPSIS
gdcmimg [options] file-in file-out DESCRIPTION
The gdcmimg command line tool can be used in two fashions: o 1. Converting a recognized file format into its encapsulated DICOM counterpart, o 2. Anonymizing a rectangular portion of a DICOM file. PARAMETERS
file-in input filename file-out output filename options PARAMETERS -i --input Input filename -o --output Output filename options --endian %s Endianness (LSB/MSB). -d --depth %d Depth (8/16/32). --sign %s Pixel sign (0/1). -s --size %d,%d Size. -C --sop-class-uid SOP Class UID (name or value). -T --study-uid Study UID. -S --series-uid Series UID. --root-uid Root UID. fill options -R --region %d,%d Region. -F --fill %d Fill with pixel value specified. general options -h --help print this help text and exit -v --version print version information and exit -V --verbose verbose mode (warning+error). -W --warning warning mode, print warning information -E --error error mode, print error information -D --debug debug mode, print debug information environment variable GDCM_ROOT_UID Root UID Supported File Format (appropriate file extension) gdcmimg will base it's conversion process based on the file extension. Follows the list of recognized file extension. When no extension is found, DICOM file is assumed. input format * RAW (raw, gray, rgb) * RLE (rle) * PNM (pgm, pnm, ppm) * JPEG-LS (jls) * JPEG 2000 (jp2, j2k, j2c, jpc) * JPEG (jpg, jpeg, ljpg, ljpeg) * DICOM () output format: * PGM (pgm, pnm, ppm) * DICOM () For RAW file format, you should take special care of the --endian option. For the (old) JPEG file format, both the lossy and lossless format are supported, user should pay attention to the --sign option. For file format such as RLE or RAW, user is expected to fill in information required to find the dimension and type of input data as there is no other way to find this information. For all other file format, the properties are derived from the file format itself. PNM file are supposed to be big endian. Typical usage Remove a rectangular part of the image To fill the region [0,100]x[0,100] of a DICOM image simply do: $ gdcmimg --fill 0 --region 0,100,0,100 -i input.dcm -o output_black.dcm Warning: if the Pixel Data is compressed, the image is first decompressed so that pixel can be set to 0, but it is not recompressed. Convert RAW to DICOM Recognized extension is .raw, .gray or .rgb (case insensitive) $ gdcmimg --size 512,512 --depth 16 -i input.raw -o output.dcm the image will be a Secondary Capture When the input is 3 component, one need to specify explicitely the Samples Per Pixel: $ gdcmimg --size 512,512 --spp 3 input_rgb.raw output_rgb.dcm When the filename contains .rgb as file extension output is automatically recognized as RGB no need to specify --spp $ gdcmimg --size 512,512 input.rgb output_rgb.dcm You can use the dd cmd line to skip any header you would like to discard, for instance, if you would like to skip the first 108 bytes, simply do: $ dd skip=108 bs=1 if=input.raw of=output.raw Convert PGM/PNM/PPM to DICOM Recognized extensions are .pgm, .pnm, .ppm (case insensitive) $ gdcmimg -i input.pgm -o output.dcm the image will be a Secondary Capture Convert RLE to DICOM Recognized extension is .rle (case insensitive) $ gdcmimg --size 512,512 --depth 16 -i input.rle -o output.dcm the image will be a Secondary Capture Convert JPEG to DICOM Recognized extensions are .jpg, .jpeg, .ljpg, .ljpeg (case insensitive) $ gdcmimg -i input.ljpeg -o output.dcm the image will be a Secondary Capture Convert J2K to DICOM Recognized extensions are .j2k, .jp2, .jpc (case insensitive) $ gdcmimg -i input.j2k -o output.dcm the image will be a Secondary Capture Specifying a SOP Class UID Instead of the default Secondary Capture Image Storage, one may want to specify, say VL Photographic Image Storage. $ gdcmimg --sop-class-uid 1.2.840.10008.5.1.4.1.1.77.1.4 input.jpg output.dcm Multiple Files gdcmimg handle nicely a set of files (for instance jpeg): $ gdcmimg 1.jpg 2.jpg 3.jpg 4.jpg output.dcm Warning There are a couple of issues with gdcmimg implementation: For JFIF file and JP2 file (with header) the header is copied into the Pixel Data element which is illegal for JP2. Use gdcmconv to properly re-encode a JP2/JFIF file into J2K/JPG. $ gdcmimg input.jp2 output_jp2.dcm $ gdcmconv --j2k --force output_jp2.dcm output_j2k.dcm For RLE file, no check is done for crossing the row boundary. It is recommended to use gdcmconv --rle to re-encode into a proper RLE file in case of doubt. Of course if the compression is not ok with your setup, you can always de-encapsulated the DICOM file (typically JPEG) to a non- encapsulated form, using gdcmconv: $ gdcmconv --raw input_jpeg.dcm output_raw.dcm SEE ALSO
gdcmdump(1), gdcmdump(1), gdcmraw(1), convert(1), dd(1) COPYRIGHT
Copyright (c) 2006-2011 Mathieu Malaterre Version 2.2.0 Tue Feb 5 2013 gdcmimg(1)
All times are GMT -4. The time now is 09:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy