Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to select files based on a criteria? Post 302652605 by balajesuri on Thursday 7th of June 2012 11:00:26 AM
Old 06-07-2012
Code:
perl     # The language compiler
-e       # Allows you to write code on command line to be executed by compiler
-p       # Iterate over each line of file and print by default
/^fff/   # Pattern matching - match string that starts with "fff"
&&       # Logical AND operator
last     # Stop iterating and go to end of loop (in this case, eof)
file     # Input file name

To summarise: Iterate over each line of file and print it. If line starts with "fff", stop iterating.
This User Gave Thanks to balajesuri For This Post:
 

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
passwd_import(1m)														 passwd_import(1m)

NAME
passwd_import - Creates registry database entries based on information in UNIX group and password files SYNOPSIS
passwd_import [-c] -d pathname [-i] [-o org] [-p password] [-u username] [-h] [-v] OPTIONS
Run in check mode: process the command, showing all conflicts, but make no requests for resolution. The path to the directory containing the foreign password and group files to be imported. Ignore name confilcts. Names in the registry and the group and password files repre- sent the same identity. The name of an organization to be assigned to all imported entries. The default organization is none. The pass- word for the account with whose privileges passwd_import will run. The principal name of the account with whose privileges passwd_import will run. This account must have the privileges to access the registry and add principals, groups, accounts, and organizations, and to add members to groups and organizations. The principal name and password are used to obtain network authentication. If you do not supply them, passwd_import prompts for them, even if you have already performed a network login. Display help information. Run in verbose mode: generate a verbose transcript of passwd_import activity. DESCRIPTION
The passwd_import command is a mechanism for creating registry database entries that are consistent with foreign password and group file entries. Use passwd_import to ensure consistency between DCE and foreign protection mechanisms when you do the following: Attach DCE node(s) to an existing UNIX network Attach UNIX node(s) to a DCE network Connect DCE and UNIX networks If the password and group file entries do not exist in the DCE registry, passwd_import creates them. If there are duplicate entries, passwd_import follows your directions on how to handle them. The Process The DCE registry database must exist and be running before you can use passwd_import. If you are simply adding a few DCE nodes to a for- eign network, you can create a new, but empty, registry to meet this requirement. As passwd_import processes, it performs the following steps: It opens the group and password files and establishes a connection to the reg- istry. It compares the group file entries to groups in the registry. If there are no conflicts, it creates groups in the registry corre- sponding to the groups in the group file. It compares the entries in the password file to principals in the registry. Again, if there are no conflicts, it Creates principals in the registry corresponding to the entries in the password file. Adds the newly created principals to the appropriate groups. Creates accounts for the newly created principals. It re-examines the group file and adds the principals as members of any addtional groups it finds there. The changes to the registry are made individually as each step is processed. If you do not specify the organization, the principals are added to the organization none. Conflicts During this process, passwd_import can find conflicts in name strings (for example, in the password file, joe 102; in the registry data- base, joe 555) and in UNIX IDs (for example, in the password file, joe 102; in the DCE, carmelita 102). When passwd_import finds a con- flict, it prompts for changes to make to the /etc/passwd and /etc/group entries. No changes are made to the registry entries. In other words, all conflicts are resolved in favor of the registry entry. The -i option specifies that duplicate names are not in conflict but, in fact, represent the same identity. Therefore, when duplicate names arise, no action is necessary. If you do not use the -i option, passwd_import prompts for how to handle the name conflicts. Resolving Conflicts The passwd_import command prompts for instructions to resolve the conflicts it finds. You have the following choices: You can create an alias to resolve a UNIX ID conflict. This action creates an alias for the registry object in conflict. The passwd_import command assigns this alias the same name as the conflicting entry in the /etc/group or /etc/passwd file. For example, if the entry joe 555 exists in the registry and the entry tim 555 exists in the /etc/passwd file, choosing this option creates the alias tim for joe 555. You can generate a new UNIX ID automatically or enter a new one explicitly to resolve a UNIX ID conflict. For example, if there is a conflict between the entry joe 555 in the registry and tim 555 in the /etc/passwd file, you can generate a new UNIX ID for tim. You can enter a new name to resolve a name conflict. For example if there is a conflict between the entry joe 555 in the registry and joe 383 in the /etc/passwd file, you can generate a new name for joe 383. This new name will then be added to the registry. In addition, you are given the option of ignoring the conflict and skipping this entry. Generally, you should run passwd_import with the -c option. Using the results of this run, you can determine how to handle the conflicts. If there are many conflicts, it may be more efficient to manually edit either the registry or the group and password files to resolve some of them before you run import_passwd. Registry Database Entries New registry entries created by passwd_import are assigned the following values: If the /etc/passwd file contains two entries with the same UNIX number, passwd_import creates a primary name entry for the first occurrence of the UNIX number and alises entries for each subsequent occurrence. A blank string; no fullname is added for the entry. For new groups only, all principals listed in the group file, and all principals with accounts in the password file with that group. Yes (for groups only). None. False. True. False. True. Same as pass- word file. Time of account creation. Same as password file. Default to registry authentication policy. Default to registry authentica- tion policy. Randomly generated. Note that you must modify or reset randomly generated passwords before user authentication is possible. Date and time passwd_import was run. False. False. False. True. True. Same as password file. True. RELATED INFORMATION
Commands: rgy_edit(1m), sec_admin(1m), secd(1m) passwd_import(1m)
All times are GMT -4. The time now is 03:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy