Sponsored Content
Top Forums Shell Programming and Scripting only if column1 equals this print that Post 302187769 by summer_cherry on Tuesday 22nd of April 2008 02:59:41 AM
Old 04-22-2008
Code:
line=`cat filename|wc -l`
nawk -v l="$line" '{
if (t=="")
{
	t=$0
	tf=$1
	continue
}
if(t!="" && $1!=tf)
{
	print t
	t=$0
	tf=$1
}
else if(t!="" && $1==tf)
{
	print t" "$2" "$3
	t=$0
	tf=$1
}
if(NR==l)
	print
}' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete a string on column1

Hi I have a file with multiple columns. But there is something weird on column one that is attached to the name. The good thing is that its a consistent pattern so there should be a way to remove it. So the first column looks something like this: name_345.4ml date_3456.4ml year_12.4ml... (3 Replies)
Discussion started by: kylle345
3 Replies

2. Shell Programming and Scripting

Getting rip of multiple rows based on column1

Hi, I want to get rid of multiple rows (duplicate, triplicate etc..) for only column 1. e.g. iu 2 iu 1 iu 3 k 4 jk 3 nm 4 nm 2 output k 4 jk 3 thanks (7 Replies)
Discussion started by: phil_heath
7 Replies

3. Shell Programming and Scripting

How TO: if [ Not Equals ] - Solaris 8

Hi, I have the following script which runs well :- ls -l /etc/*.txt > /dev/null 2>&1 if ; then "Success" fi But, if I try, if ; then "Success" fi Does not works ! Even, (4 Replies)
Discussion started by: angshuman_ag
4 Replies

4. Shell Programming and Scripting

Compare 3 files, delete data equals.

Hi, i have a problem, I have three files, file_1, File_2 file_3 and I need to compare the data with file_3 file_1, data that are equal to file_3 file_1 should be deleted, file_1 receive data and file_2 file_3. Ex: file_1 374905,2001, Selmar Santos, Técnico de Sistemas, U$3.000,00 789502,... (3 Replies)
Discussion started by: selmar
3 Replies

5. Shell Programming and Scripting

awk : Remove column1 and last column in a line

Hi All, How to remove col1 and last column in a line. Please suggest some awk stuffs. Input col1 col2 col3 col4 col1 col2 col3 col4 col5 col1 col2 col3 col4 col1 col2 col3 Output Processing col2 col3 ... Processing col2 col3 col4 ... Processing col2 col3 ... Processing... (5 Replies)
Discussion started by: k_manimuthu
5 Replies

6. Shell Programming and Scripting

How to output the partially equals

Hello i have 2 files: a.out 10.1.1.1 james.franco 10.1.1.3 google.gol 10.1.1.14 yahoo.bol b.out 10.1.1.1 10.1.1.3 10.1.1.45 I need to see an output just with: 10.1.1.1 james.franco 10.1.1.3 google.gol Thankz in advance!! (2 Replies)
Discussion started by: danielldf
2 Replies

7. Shell Programming and Scripting

[solved] how to check if two arrays are equals?

how to compare to arrays to check if each elements of the first are the same of the second? for ((i=0;i<$LENGTH;i++)) ; do for (j=0;j<$LENGTH;j++)) ; do if } == ${ARR2} ] echo "Are the same"; fi; done; done; i try this but it doesn't work :( if i make... (0 Replies)
Discussion started by: tafazzi87
0 Replies

8. UNIX for Dummies Questions & Answers

awk if statement / equals operator

Hi, I was hoping someone could explain this please :) I'm using bash, scientific linux... and I don't know what else you need to know. With awk '{ if( 0.3 == 0.1*3) print $1}' file.dat nothing will be printed since apparently the two numbers do not equate. (Using 0.3 != 0.1*3 is seen... (4 Replies)
Discussion started by: Golpette
4 Replies

9. UNIX for Dummies Questions & Answers

If variable equals string help

Hi All, Trying to get my bash script if statement to work however my if variable equals xxx statement doesnt appear to work, could anyone shed some light. ./script $password &> output INCORRECTPASS=`grep "Permission denied, please try again." output` echo "$INCORRECTPASS" ... (8 Replies)
Discussion started by: mutley2202
8 Replies

10. Shell Programming and Scripting

Do nothing if column1 is found

Hello, I have stucked at one point. When I run the script, I am asking the script to search in database file and if it's found, do nothing and proceed to next line in database file. #!/bin/bash ./extract_email.pl output2 > database while read -r COL1 X=$(grep $COL1 database ) if ]... (7 Replies)
Discussion started by: baris35
7 Replies
gdcmgendir(1)							       GDCM							     gdcmgendir(1)

NAME
gdcmgendir - Tool to generate a DICOMDIR file from a File-Set. SYNOPSIS
gdcmgendir [options] file-in file-out DESCRIPTION
PARAMETERS
file-in DICOM input filename file-out DICOM output filename options Parameters options -i --input DICOM filename or directory -o --output DICOM filename or directory -r --recursive recursive. --descriptor descriptor. --root-uid Root UID. 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 Typical usage NOTE
One may have to run some preliminary steps in order to get gdcmgendir to generate the DICOMDIR file. Namely two steps: o Batch renaming of the DICOM filename into something compatible with ISO 9660 filename convention o Convert all DICOM file into the Explicit VR Little Endian Uncompressed (1.2.840.10008.1.2.1) Step 1. can be solved in a numerous way. Eg. on UNIX environment this could either be solved using the mkisofs command line tool. filename should not contains any extension since the VR CS does not allow for the '.' character. Only upper case, digit 0-9, the space ' ' and the underscore '_' character are valid in VR CS, with a maximum of 8 bytes. Another simple tool that can be handy is 'rename' in conjunction with 'basename'. Step 2. can simply be achieved using the gdcmconv command line tool: $ for i in `ls IMG*`; do gdcmconv --raw --force $i /tmp/out/$i; done SEE ALSO
gdcmconv(1), gdcmanon(1), rename(1) COPYRIGHT
Copyright (c) 2006-2011 Mathieu Malaterre Version 2.2.0 Tue Feb 5 2013 gdcmgendir(1)
All times are GMT -4. The time now is 07:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy