Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to select files based on a criteria? Post 302652561 by saggiboy10 on Thursday 7th of June 2012 09:35:04 AM
Old 06-07-2012
Code:
perl -pe '/^fff/ && last' file

..........Worked........Simple Awesome...


I would love to know how this actually worked...some explaination on the code so that i can explain this to my team. Smilie

Moderator's Comments:
Mod Comment Please use next time
code tags for your code and data

Last edited by vbe; 06-07-2012 at 12:49 PM.. Reason: code tags...
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Select records based on search criteria on first column

Hi All, I need to select only those records having a non zero record in the first column of a comma delimited file. Suppose my input file is having data like: "0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005" "0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)
Discussion started by: shashi_kiran_v
2 Replies

2. Shell Programming and Scripting

Need script to select multiple files from archive directory based on the date range

hi all, here is the description to my problem. input parameters: $date1 & $date2 based on the range i need to select the archived files from the archived directory and moved them in to working directory. can u please help me in writing the code to select the multiple files based on the... (3 Replies)
Discussion started by: bbc17484
3 Replies

3. Shell Programming and Scripting

Archive files to different target folders based on criteria

Hi All, I am creting archive script in which i need to split the source file's to different target folder's based on the input file name first character. Input1.txt -- will contains file names that are needs to be Archive. Input1.txt A1213355 B2255666 C2254555 A6655444 C5566445 ... (2 Replies)
Discussion started by: kmsekhar
2 Replies

4. UNIX for Dummies Questions & Answers

How to fetch files right below based on some matching criteria?

I have a requirement where in i need to select records right below the search criteria qwertykeyboard white 10 20 30 30 40 50 60 70 80 qwertykeyboard black 40 50 60 70 90 100 qwertykeyboard and white are headers separated by a tab. when i execute my script..i would be searching... (4 Replies)
Discussion started by: vinnu10
4 Replies

5. 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

6. UNIX for Dummies Questions & Answers

Select all files in a folder based on creation date (ls command)

Hi All, <Re-posting in Correct group> I'm trying to select all the files in a folder that starts with a particular name format and are created in a gven date range using 'ls' command...but i'm not successful.... Example : I'm trying to see all the text files in a folder who names start... (6 Replies)
Discussion started by: Satya C1
6 Replies

7. Shell Programming and Scripting

Comparing Select Columns from two CSV files in UNIX and create a third file based on comparision

Hi , I want to compare first 3 columns of File A and File B and create a new file File C which will have all rows from File B and will include rows that are present in File A and not in File B based on First 3 column comparison. Thanks in advance for your help. File A A,B,C,45,46... (2 Replies)
Discussion started by: ady_koolz
2 Replies

8. Linux

Merge two files based on matching criteria

Hi, I am trying to merge two csv files based on matching criteria: File description is as below : Key_File : 000|ÇÞ|Key_HF|ÇÞ|Key_FName 001|ÇÞ|Key_11|ÇÞ|Sort_Key22|ÇÞ|Key_31 002|ÇÞ|Key_12|ÇÞ|Sort_Key23|ÇÞ|Key_32 003|ÇÞ|Key_13|ÇÞ|Sort_Key24|ÇÞ|Key_33 050|ÇÞ|Key_15|ÇÞ|Sort_Key25|ÇÞ|Key_34... (3 Replies)
Discussion started by: PK29
3 Replies

9. UNIX for Beginners Questions & Answers

Select and copy .csv files based on row and column number

Dear UNIX experts, I'm a command line novice working on a Macintosh computer (Bash shell) and have neither found advice that is pertinent to my problem on the internet nor in this forum. I have hundreds of .csv files in a directory. Now I would like to copy the subset of files that contains... (8 Replies)
Discussion started by: rcsapo
8 Replies
hostid(1)						      General Commands Manual							 hostid(1)

NAME
hostid - Sets or displays the identifier of the local host SYNOPSIS
/usr/sbin/hostid [hostname | hexadecimal_number | internet_address] DESCRIPTION
The hostid command displays the 32-bit identifier of the host as a hexadecimal number in host standard byte order. The identifier must be unique across all hosts and is commonly set to the Internet address of the specified host. The superuser can set the host ID by specifying a hostname, internet_address, or hexadecimal_number argument. The identifier is stored in network standard byte order. EXAMPLES
To display the identifier of the local host, enter: $ hostid 0xc009c803 The hostid command displays the identifier of the host as a hexadecimal number in host standard byte order. To set the identifier of the local host to the local Internet address, enter: $ hostid 555.5.55.555 The hostid command converts the Internet address to its hexadecimal equivalent, and then sets the local host to this address. Note that the sample Internet address in this example, 555.5.55.555, is not a valid Internet address and would cause hostid to return an error. SEE ALSO
Commands: hostname(1) Functions: gethostid(2), sethostid(2) hostid(1)
All times are GMT -4. The time now is 02:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy