Sponsored Content
Full Discussion: Grep by column-Please help!
Top Forums UNIX for Dummies Questions & Answers Grep by column-Please help! Post 302071434 by Perderabo on Wednesday 19th of April 2006 01:03:48 PM
Old 04-19-2006
The awk solution will print out records with 52 in field 6. amro1's solution will either print out a column of 11's or it will print out records with 11 anywhere depending on what columns are selected. The perl solution results in stuff like:
52 not found
52 not found
52
52 not found
52 not found
52 not found
52 not found

Looking at the original post we can see the desired out. The awk solution is really close, we just need to turn those commas into spaces...
$ awk -F, '$6==52 {gsub(","," ");print $0}' < data
0 52 3 3 62 52 3 3 62 1411
0 52 2 2 14 52 2 2 14 1501
0 52 3 4 14 52 3 4 14 1473
0 52 1 3 48 52 1 3 48 1431
$
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep by column number

I have a data file that is arranged like this: Marketing Ranjit Singh Eagles Dean Johnson FULL Marketing Ken Whillans Eagles Karen Thompson FULL Sales Peter RobertsonGolden TigersRich Gardener PART President Sandeep Jain Wimps Ken Whillans CONT... (7 Replies)
Discussion started by: hitman247m
7 Replies

2. Shell Programming and Scripting

Column grep

hi everyone, I am looking for an easy way to extract columns from a text file based on a regular expression, kind of like grep but searching and returning columns instead. for example, suppose i have the following file, 'file.txt': A B C D B 1 2 3 4 5 6 7 8 9 0 5 6 7 8 9 2 3 8 9 0 I... (6 Replies)
Discussion started by: css136
6 Replies

3. Shell Programming and Scripting

Grep but ignore first column

Hi, I need to perform a grep from a file, but ignore any results from the first column. For simplicity I have changed the actual data, but for arguments sake, I have a file that reads: MONACO Monaco ASMonaco MANUTD ManUtd ManchesterUnited NEWCAS NewcastleUnited NAC000 NAC ... (5 Replies)
Discussion started by: danhodges99
5 Replies

4. Shell Programming and Scripting

Grep 5 biggest column

please help, file1.txt id,week,ict,outgoing_call,blackberry_problem,gprs_problem,sms_problem,flash_problem,sinyal_lemah,blankspot,incoming_call,mms_problem,kualitas_suara,drop_call,data_probl em,cross_connect,connect_no_voice,vas_problem ,1,sumbagsel,96,127,52,70,28,29,21,18,18,8,5,3,0,0,3... (1 Reply)
Discussion started by: radius
1 Replies

5. Shell Programming and Scripting

How to awk or grep the last column in file when date on column contains spaces?

Hi have a large spreadsheet which has 4 columns APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96034 Storage Mgmt Team APM00111803814 server_2 96152 GWP... (6 Replies)
Discussion started by: kieranfoley
6 Replies

6. UNIX for Dummies Questions & Answers

Grep -v value in 2nd column

Trying to do a grep -v on a value in the 2nd column of text. So if the word apple appears in a line in the 2nd column, it would not show up when the file was cat. Seems like a simple enough operation but I just can't figure it out. Any help would be appreciated. Thanks in advance. Are apples... (4 Replies)
Discussion started by: jimmyf
4 Replies

7. Shell Programming and Scripting

How to grep from the third column?

PROL\tests_li004_developers:VAS:3543346:q34243,d3hs35,34bdf3,24sfgg,a3s234 Im trying to grep all text after VAS:3543346, so im trying to just have this q34243,d3hs35,34bdf3,24sfgg,a3s234 Im confused on how I would do this (7 Replies)
Discussion started by: ajetangay
7 Replies

8. Shell Programming and Scripting

Can grep a specific column?

Hello All I have an input file with data below. I would like to grep and display the data where 3rd column contains string or at least one character. Kindly please help me with this! Input: tjfa3|zznpou|224fdd.34.ff3.35 |Tiv|Otj|1 fgduul7|zznikj| ... (7 Replies)
Discussion started by: DoveLu
7 Replies

9. UNIX for Beginners Questions & Answers

Grep A Column Based On Column Name

I have a file with two columns separated by white space. Dog Cat fido sneaky dopey poptart ears whisker barky herd Trying to list the words under the column named Dog. Tried a few variations of awk but can't... (4 Replies)
Discussion started by: jimmyf
4 Replies

10. Shell Programming and Scripting

Grep values from column 2 in reference of column 1

Gents Is it possible to update the code to get the desired output files from the input list. I called variable to the first column. I need to consider the first column as key to grep the values in the second column according to the desired request. input list (attached ) output1 ... (12 Replies)
Discussion started by: jiam912
12 Replies
TABLIX(1)						       Tablix User's Manual							 TABLIX(1)

NAME
tablix2_test - Tablix testing framework front-end SYNOPSIS
tablix2_test command options file DESCRIPTION
Tablix is a powerful free software kernel for solving general timetabling problems. It uses a coarse-grained parallel genetic algorithm in combi- nation with other techniques to construct sensible timetables from XML formatted problem descriptions. Tablix can run on a single host as well as on a heterogeneous parallel virtual machine using PVM3. Tablix testing framework provides a way to write simple automated tests that verify if a module and/or kernel is working as expected. Framework is composed of a special export module export_ttf.so and a utility program tablix2_test. Each automated test case is stored in a single file with the standard Tablix XML configuration syntax and a special XML comment block containing a short program written in Scheme. tablix2_test first processes each file containing the test case with tablix or tablix2 (depending on the detected version of the XML format) and then uses export_ttf.so module to run the Scheme code included in the same file to verify if the kernel has found a correct solution. For each test case, tablix2_test reports one of the following results: passed File contained XML syntax for the 0.2.x branch of kernels. tablix2 found a solution to the test problem and Scheme code confirmed that it is correct. passed (old syntax) File contained XML syntax for the 0.1.x branch of kernels. tablix found a solution to the test problem and Scheme code confirmed that it is cor- rect. skipped tablix or tablix2 executable was not found. Test problem was skipped. FAILED (tablix crashed) Tablix did not find a solution to the test problem. The reason can be a syntax error in the XML configuration file, an error in the module or a kernel crash. See any other displayed error messages for details. FAILED (most likely scheme syntax error) Scheme interpreter returned an error. The reason can be a syntax error or a bug in the Scheme code block. See any other displayed error messages for details. FAILED (ttf test failed) Tablix found a solution to the test problem but Scheme code did not confirm it. FAILED (unknown error) Tablix returned an unknown return value. You are probably running an outdated tablix2_test. Since tablix or tablix2 is run as part of the process, pvmd daemon must be running and be configured properly before running tablix2_test OPTIONS
tablix2_test --file ";OPTIONS" FILE Perform once a single test stored in the XML configuration file FILE. OPTIONS parameter is mandatory and contains options that will be passed to the tablix or tablix2 process. tablix2_test --dir ";OPTIONS" DIRECTORY Perform once all tests stored in XML configuration files in the directory DIRECTORY. OPTIONS parameter is mandatory and contains options that will be passed to the tablix or tablix2 process. tablix2_test --multi-file N ";OPTIONS" FILE Same as --file but performs each test N times. Test is considered passed only none of N repetitions of the test fail. tablix2_test --multi-dir N ";OPTIONS" DIRECTORY Same as --dir but performs each test in the directory N times. Test is considered passed only none of N repetitions of the test fail. EXAMPLES
To perform an exhaustive test of all kernel features and all modules in the distribution, run the following command from the top of the Tablix source tree: tablix2_test --multi-dir 7 "" ttf/tests A correctly working Tablix installation should pass all tests stored in the ttf/tests/ subdirectory except the error-1.xml, error-2.xml and error-3.xml tests which verify that the testing framework is correctly reporting errors. BUGS
tablix2_test utility depends on a number of common UNIX programs (mktemp, grep, sed, awk, ...) that may not be available on all systems. The script is not currently capable of properly detecting if any required programs are missing. AUTHOR
Tomaz Solc (tomaz.solc@tablix.org) SEE ALSO
tablix2(1), Tablix User's Manual, Tablix modules HOWTO Tomaz Solc 2005-09-03 TABLIX(1)
All times are GMT -4. The time now is 12:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy