Sponsored Content
Full Discussion: Filtering data base on range
Top Forums Shell Programming and Scripting Filtering data base on range Post 302822829 by nua7 on Tuesday 18th of June 2013 09:10:35 AM
Old 06-18-2013
Filtering data based on range in column

Hi All,
I have the file in following format. I need to change column 16 and column 17 for those lines which has atleast one numerical digit in column 2 , with the exception on SUPP1

Input file :
Code:
S00005615|1044|0|0.00|0|0.00| |112|-30|28.1|0|0| |20130331|220.2|2|3|
S00005623|ESSEX|0|0.00|0|0.00| |136|-116|0|0|0| |20130331|40|23|45|
S00005666|2013|0|0.00|0|0.00| |112|-30|28.1|0|0| |20130331|220.2|56|45|
S00005683|NORFO|0|0.00|0|0.00| |112|60.9|0|0|0| |20130331|345.8|32|45|
S00005702|2511|-31.2|0.00|0|0.00| |112|60.9|0|0|0| |20130331|283.4|23|453|
S00005721|SUPP1|0|0.00|0|0.00| |112|28.1|0|0|0| |20130331|280.2|23|12|

Output File :
Code:
S00005615|1044|0|0.00|0|0.00| |112|-30|28.1|0|0| |20130331|220.2|0|0|
S00005623|ESSEX|0|0.00|0|0.00| |136|-116|0|0|0| |20130331|40|23|45|
S00005666|2013|0|0.00|0|0.00| |112|-30|28.1|0|0| |20130331|220.2|0|0|
S00005683|NORFO|0|0.00|0|0.00| |112|60.9|0|0|0| |20130331|345.8|32|45|
S00005702|2511|-31.2|0.00|0|0.00| |112|60.9|0|0|0| |20130331|283.4|0|0|
S00005721|SUPP1|0|0.00|0|0.00| |112|28.1|0|0|0| |20130331|280.2|23|12|

What's the best way o doing this in shell or awk.Any help is really appreciated

Last edited by nua7; 06-18-2013 at 10:20 AM..
 

9 More Discussions You Might Find Interesting

1. Programming

data base

Dear sirs, I am new to DataBase in C++,Also here iam using mysql, How can do it nad get the result back from the database and do operation onit. Thanks in advance, arunkumar (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

2. Shell Programming and Scripting

Using loop reading a file,retrieving data from data base.

Hi All, I am having trouble through, I am reading the input from tab delimited file containing several records, e.g. line1 field1 field2 field3 so on.. line2 field1 field2 field3 so on.. .. .. on the basis of certain fields for each record in input file, I have to retrieve... (1 Reply)
Discussion started by: Sonu4lov
1 Replies

3. Shell Programming and Scripting

data base update

hello everyone I need to update data base in file 1-ID 2-Name 3-ID group 4-ID teacher 5-mark list unique ID is (ID+ID group+ID teacher) we can append 5 th columns (marks list) main base file: Code: 1:John:3:1:4 3 2 2:Mark:1:2:1 3 3:Susan:3:4: input file: (1 Reply)
Discussion started by: mleplawy
1 Replies

4. Shell Programming and Scripting

filtering a range of ports out of a netstat output

i'd like to grep a range of ports on a netstat -nt output, localaddress, say :1 to :1023. how do i do it via sed/awk/grep? Thanks, Marc (1 Reply)
Discussion started by: marcpascual
1 Replies

5. Shell Programming and Scripting

sed filtering lines by range fails 1-line-ranges

The following is part of a larger project and sed is (right now) a given. I am working on a recursive Korn shell function to "peel off" XML tags from a larger text. Just for context i will show the complete function (not working right now) here: function pGetXML { typeset chTag="$1" typeset... (5 Replies)
Discussion started by: bakunin
5 Replies

6. Shell Programming and Scripting

Change Data base on Column

Base of last two column i want to change may data if Last two Column have A and C then Copy Column $4 to Column $3. Input :- DD142 0_1 DD142_A DD142_B A B DD142 1_1 DD142_B DD142_C B C DD142 2_1 DD142_A DD142_C A C DD142 3_1 DD142_A A DD142 3_2 DD142_A A DD142 4_1 DD142_B B ... (4 Replies)
Discussion started by: pareshkp
4 Replies

7. Shell Programming and Scripting

Combine data from two files base on uniq data

File 1 ID Name Po1 Po2 DD134 DD134_4A_1 NN-1 L_0_1 DD134 DD134_4B_1 NN-2 L_1_1 DD134 DD134_4C_1 NN-3 L_2_1 DD142 DD142_4A_1 NN-1 L_0_1 DD142 DD142_4B_1 NN-2 L_1_1 DD142 DD142_4C_1 NN-3 L_2_1 DD142 DD142_3A_1 NN-41 L_3_1 DD142 DD142_3A_1 NN-42 L_3_2 File 2 ( Combination of... (1 Reply)
Discussion started by: pareshkp
1 Replies

8. Shell Programming and Scripting

Grep Data Base on Column

HI Want to grep data from column header and match with second file. File A.txt 1 2 3 4 5 6 X1 A L D J Q R X2 B M K P w T X3 C S L P e Y X4 R Z M A r U FileB.txt 1 2 3 4 6 7 (3 Replies)
Discussion started by: pareshkp
3 Replies

9. Shell Programming and Scripting

Grep Data Base on Header

HI Guys, File A.txt UID,HD1,HD2,HD3,HD4 1,2,33,44,55 2,10,14,15,16 File B.txt UID HD1 HD4 A.txt B.txt >>>Output.txt UID,HD1,HD4 1,2,55 2,10,16 (11 Replies)
Discussion started by: pareshkp
11 Replies
COLUMN(1)						    BSD General Commands Manual 						 COLUMN(1)

NAME
column -- columnate lists SYNOPSIS
column [-tx] [-c columns] [-s sep] [file ...] DESCRIPTION
The column utility formats its input into multiple columns. Rows are filled before columns. Input is taken from file operands, or, by default, from the standard input. Empty lines are ignored. The options are as follows: -c Output is formatted for a display columns wide. -s Specify a set of characters to be used to delimit columns for the -t option. -t Determine the number of columns the input contains and create a table. Columns are delimited with whitespace, by default, or with the characters supplied using the -s option. Useful for pretty-printing displays. -x Fill columns before filling rows. ENVIRONMENT
The COLUMNS, LANG, LC_ALL and LC_CTYPE environment variables affect the execution of column as described in environ(7). EXIT STATUS
The column utility exits 0 on success, and >0 if an error occurs. EXAMPLES
(printf "PERM LINKS OWNER GROUP SIZE MONTH DAY " ; printf "HH:MM/YEAR NAME " ; ls -l | sed 1d) | column -t SEE ALSO
colrm(1), ls(1), paste(1), sort(1) HISTORY
The column command appeared in 4.3BSD-Reno. BUGS
Input lines are limited to LINE_MAX (2048) bytes in length. BSD
July 29, 2004 BSD
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy