473,499 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unix Record Extract by Column Value

2 New Member
I have a file of thousands of records. In column 87 it can contain 001, 002, 003, or 004. I need a quick easy way to create an output with all the records greater than 002. What unix command can do this? Or, do I need to write a quick program.
Apr 15 '10 #1
4 3624
rski
700 Recognized Expert Contributor
You do not write what is the column separator, assuming it is a ':' yo can do something like that
Expand|Select|Wrap|Line Numbers
  1. awk 'BEGIN{$IFS=":"}$87=!/00[1,2]/{print}' <filename>
  2.  
I guess saying grater than 002 you mean rows which do not contain 001and 002
Apr 15 '10 #2
jraymond
2 New Member
There are no column separators just a string of alphanumeric data. Basically I have a datafile being transmitted to us and I neet to strip off certain records.
Apr 15 '10 #3
rski
700 Recognized Expert Contributor
@jraymond
If there are no column separator, how do you recognize that 001 is in column 87?
Can you put here some data from that datafile and show where do you think 87th column is.
Apr 15 '10 #4
ennoil
11 New Member
You can use the cut (-b) command and specify what position in the string that you want to look at...From there you can use an if statement:

Expand|Select|Wrap|Line Numbers
  1. for i in `cat <file>`
  2. do
  3.   section=`echo ${i} | cut -b 87-89`
  4.   if [[ ${section} == "003" -o ${section} == "004"
  5.   then
  6.     echo ${section}
  7.   fi
  8. done
Just for a start...
May 28 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2628
by: Amber | last post by:
There are times when you will need to highlight or otherwise modify the contents of a particular DataGrid row-column value based upon the value in the column. In this example we will select the...
5
1343
by: Alan | last post by:
I want search for a record in a table that a record's field value matching a particular value eg. customer name. What property or method of data binding manager or dataset on a form has this ?
4
7209
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
0
2055
by: Joe Meng | last post by:
Greetings, I've seen this question asked and answered here, just not completely yet. I'm wondering how to use a column value as a table name in another query. So far it's looking like you must...
7
8680
by: hjohnson | last post by:
Within the access environment, I have a table that I'd like to -add a column -place the record number of each record into that column The autonumber is not working for me because I am...
4
10659
by: luthriaajay | last post by:
Hi, I need to use XPATH to extract the value of attribute ID in element Instrmt <?xml version="1.0" encoding="UTF-8"?> <FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4"> <Order...
2
3550
by: luthriaajay | last post by:
I need some help to extract the LatestFillQuantity element value using XPATH. in Java. I am unable to extract the value of 10000. Please help as to what have I done wrong.? Help appreciated. ...
0
1720
by: sk27ahmed | last post by:
Hi Any one can show me how to access datagridview column value on column checked unchecked. I create one column in datagridview of type checkbox,and on button click i write code to select all...
8
2412
by: poolboi | last post by:
hi guys, i just did printing to a certain file #!perl\bin\perl use strict; use warnings; my $t; my @ok;
0
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.