Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Select records based on search criteria on first column Post 91486 by bakunin on Friday 2nd of December 2005 12:49:19 PM
Old 12-02-2005
sed '/^"0"/d' yourfile.in > yourfile.result

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete new lines based on search criteria

Hi all! A bit of background: I am trying to create a script that formats SQL statements. I have gotten so far as to add new lines based on certain match criteria like commas, keywords etc. In the process, I end up adding newlines where I don't want. For example: substr(colName, 1, 10)... (3 Replies)
Discussion started by: jayarkay
3 Replies

2. Shell Programming and Scripting

substract column based on some criteria

Please guide if you know how to solve this. I have a tab delimited INPUT FILE where each record is separated by ----- ----- ABC 4935402 4936680 Pattern=Cheers07080.1 ABC 4932216 4932368 Pattern=Cheers07080.1 ABC 4931932 4932122 ... (8 Replies)
Discussion started by: sam_2921
8 Replies

3. Shell Programming and Scripting

Extract data based on specific search criteria

I have a huge file (about 2 millions records) contains data separated by “,” (comma). As part of the requirement, I can't change the format. The objective is to remove some of the records with the following condition. If the 23rd field on each line start with 302 , I need to remove that from the... (4 Replies)
Discussion started by: jaygamini
4 Replies

4. Shell Programming and Scripting

Select only top "N" records based on column value

Hi Gurus, I know this'll be simple task for all the geeks out here but me being a newbie is finding it hard to crack this shell. Ok coming to the task I've a delimited file as below ================================================== ==================================================== ... (8 Replies)
Discussion started by: asandy1234
8 Replies

5. UNIX for Dummies Questions & Answers

How to select files based on a criteria?

I have a file..... xxx 2345 455 abc 345 555 cdf 456 777 fff 555 888 Now my requirement is, Say if, i want to select only those records prior to the record fff 555 888... how do i go about doing this in unix.... The fff would be hardcoded as it wud be fixed and everytime when i... (7 Replies)
Discussion started by: saggiboy10
7 Replies

6. Shell Programming and Scripting

Extract error records based on specific criteria from Unix file

Hi, I look for a awk one liner for below issue. input file ABC 1234 abc 12345 ABC 4567 678 XYZ xyz ght 678 ABC 787 yyuu ABC 789 7890 777 zxr hyip hyu mno uii 678 776 ABC ty7 888 All lines should be started with ABC as first field. If a record has another value for 1st... (7 Replies)
Discussion started by: ratheesh2011
7 Replies

7. Shell Programming and Scripting

Select lines from a file based on a criteria

Hi I need to select lines from a txt file, I have got a line starting with ZMIO:MSISDN= and after a few line I have another line starting with 'MOBILE STATION ISDN NUMBER' and another one starting with 'VLR-ADDRESS' I need to copy these three lines as three different columns in a separate... (3 Replies)
Discussion started by: Tlcm sam
3 Replies

8. Shell Programming and Scripting

Need To Delete Lines Based On Search Criteria

Hi All, I have following input file. I wish to retain those lines which match multiple search criteria. The search criteria is stored in a variable seperated from each other by comma(,). SEARCH_CRITERIA = "REJECT, DUPLICATE" Input File: ERROR,MYFILE_20130214_11387,9,37.75... (3 Replies)
Discussion started by: angshuman
3 Replies

9. Shell Programming and Scripting

Copying section of file based on search criteria

Hi Guru's, I am new to unix scripting. I have a huge file with user details in it(file2) and I have another file with a list of users(file1). Script has to search a user from file1 and get all the associated lines from file2. Example: fiel1: cn=abc cn=DEF cn=xyx File 2: dn:... (10 Replies)
Discussion started by: Samingla
10 Replies

10. Shell Programming and Scripting

Awk/sed/cut to filter out records from a file based on criteria

I have two files and would need to filter out records based on certain criteria, these column are of variable lengths, but the lengths are uniform throughout all the records of the file. I have shown a sample of three records below. Line 1-9 is the item number "0227546_1" in the case of the first... (15 Replies)
Discussion started by: MIA651
15 Replies
ARRAY_COLUMN(3) 							 1							   ARRAY_COLUMN(3)

array_column - Return the values from a single column in the input array

SYNOPSIS
array array_column (array $array, mixed $column_key, [mixed $index_key = null]) DESCRIPTION
array_column(3) returns the values from a single column of the $array, identified by the $column_key. Optionally, you may provide an $index_key to index the values in the returned array by the values from the $index_key column in the input array. PARAMETERS
o $array - A multi-dimensional array (record set) from which to pull a column of values. o $column_key - The column of values to return. This value may be the integer key of the column you wish to retrieve, or it may be the string key name for an associative array. It may also be NULL to return complete arrays (useful together with $index_key to reindex the array). o $index_key - The column to use as the index/keys for the returned array. This value may be the integer key of the column, or it may be the string key name. RETURN VALUES
Returns an array of values representing a single column from the input array. EXAMPLES
Example #1 Get column of first names from recordset <?php // Array representing a possible record set returned from a database $records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', ), array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones', ), array( 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe', ) ); $first_names = array_column($records, 'first_name'); print_r($first_names); ?> The above example will output: Array ( [0] => John [1] => Sally [2] => Jane [3] => Peter ) Example #2 Get column of last names from recordset, indexed by the "id" column <?php // Using the $records array from Example #1 $last_names = array_column($records, 'last_name', 'id'); print_r($last_names); ?> The above example will output: Array ( [2135] => Doe [3245] => Smith [5342] => Jones [5623] => Doe ) PHP Documentation Group ARRAY_COLUMN(3)
All times are GMT -4. The time now is 07:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy