Sponsored Content
Top Forums UNIX for Dummies Questions & Answers deleting lines from a delimited files based on a 2nd file Post 302302233 by goldie363 on Monday 30th of March 2009 12:17:16 PM
Old 03-30-2009
deleting lines from a delimited files based on a 2nd file

I need a little help...

I have a file with 3 fields,

Time/Date, IP address, UniqueID

I have a 2nd file of UniqueIDs.

I want to either (which ever is easier):
1. delete entries in file 1 that have a UniqueID in file 2
2. create a new file with the fields from File 1, excluding the UniqueIDs in file 2.

Both files are in .CSV format.

Thanks in advance for any assistance.

Peter
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

deleting files based on file name and modified time

Hi, I have some log files created in the following fashion Ex: file name modified date 1) s.log1 01-jan-08 2) s.log2 02-jan-08 3) s.log3 03-jan-08 4) s.log4 04-jan-08 Now I want to have the latest 2 logs and delete the others. Can you tell me the one liner /... (1 Reply)
Discussion started by: ammu
1 Replies

2. Shell Programming and Scripting

Finding duplicate lines and deleting folders based on them

Hi, I have research data, which is organized to 100 folders numbered 00-99. I have many sets of 100 folders, for different values of initial parameters. For some reason, the computer that ran the program to gather the data, didn't always create a unique seed for each folder. I anticipated that... (1 Reply)
Discussion started by: Jopi
1 Replies

3. Shell Programming and Scripting

Searching patterns in 1 file and deleting all lines with those patterns in 2nd file

Hi Gurus, I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies

4. UNIX for Dummies Questions & Answers

Deleting columns from a space delimited text file

I have a space delimited text file with 1,000,000+ columns and 100 rows. I want to delete columns 2 through 5 (2 and 5) included from the text file. How do I do that? Thanks. (3 Replies)
Discussion started by: evelibertine
3 Replies

5. UNIX for Dummies Questions & Answers

Deleting columns from a tab delimited text file?

I have a tab limited text file with 10000+ columns. I want to delete columns 6 through 23, how do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

6. UNIX for Dummies Questions & Answers

Deleting lines that contain a specific string from a space delimited text file?

Hi, I have a space delimited text file that looks like the following: 250 rs10000056 0.04 0.0888 4 189321617 250 rs10000062 0.05 0.0435 4 5254744 250 rs10000064 0.02 0.2403 4 127809621 250 rs10000068 0.01 NA 250 rs1000007 0.00 0.9531 2 237752054 250 rs10000081 0.03 0.1400 4 17348363... (5 Replies)
Discussion started by: evelibertine
5 Replies

7. UNIX for Dummies Questions & Answers

[Solved] deleting pattern based lines in sed

HI, My input file contains below data: DFHDR 12345110 1,200 2,-100 1,100 2,123 12345110 1,300 2,200 DFTLR In the above data, the first line and last lines should be remove as well as the lines in which contains 110 as position(6,7,8 position) should also be removed, How we... (0 Replies)
Discussion started by: pandeesh
0 Replies

8. Shell Programming and Scripting

Generate files from one file based on lines

Hi Friends, I have a file1 file1.txt 1ABC 13478 aqjerh 473 343 2hej 478 5775 24578 23892 3fhd fg 847 brjkb f99345 487 4eh ehjk 84 47589 8947 234 5784 487 738 52895 8975 6 57489 eghe9 4575 859479 7fnbd 4y5 4iuy 458 h irh 8fjdg 74 7845 8475 5789 94yr 48yr 4hr erhj reh... (3 Replies)
Discussion started by: i150371485
3 Replies

9. Shell Programming and Scripting

Deleting lines based on a condition for a group of files

hi i have a set of similar files. i want to delete lines until certain pattern appears in those files. for a single file the following command can be used but i want to do it for all the files at a time since the number is in thousands. awk '/PATTERN/{i++}i' file (6 Replies)
Discussion started by: anurupa777
6 Replies

10. Shell Programming and Scripting

Help with a deleting lines based on a pattern

I have a header-detail file that goes like this: SHP00288820131021110921 ORDER0156605920131021110921INMMMMFN DETAIL0004 4C2Z 10769 AAFC 0000009600000094 4C2Z 10769 AAFC 0000672107 OIL DETAIL0002 ER3Z 14300 E 0000001300000012 ER3Z 14300 E 0000672107 OIL... (3 Replies)
Discussion started by: rbaggio666
3 Replies
dsimport(1)						    BSD General Commands Manual 					       dsimport(1)

NAME
dsimport SYNOPSIS
dsimport filepath nodepath O|M|A|I|N [options] dsimport --version dsimport --help DESCRIPTION
dsimport is a tool for importing records into an Open Directory source. USAGE
filepath is the path of the file to be imported. nodepath is the path of the Open Directory node where the records should be imported. A flag that specifies how to handle conflicting records: O overwrite of any existing records that have the same record name, UID or GID. All previous attribute values are deleted. M merge import data with existing records or create the record if it does not exist. I ignore the record if there is a conflicting name, UID or GID. A append the data to existing records, but do not create a record if it does not exist. N no duplicate checking should be done. Note this could cause failures and/or a slower import process. A list of options and their descriptions: --crypt is used to signify that all user passwords are crypt-based. Entries in the import file can also be prefixed with {CRYPT} on a per record basis if not all users are crypt-based. By default all passwords are assumed to be provided as listed in the import file. --force attribute value forces a specific value for the named attribute for all records during the import. The new value will overwrite any value specified in the import file. This option may be specified multiple times for forcing more than one attribute. --groupid value is the GID used for any records that do not specify a primary GID. --grouppreset value designate a preset record to be applied to imported group records. --loglevel value changes the amount of logging detail output to the log file. --outputfile value Outputs a plist to the specified file with a list of changed users or groups and rejected records due to name conflicts. Also includes a list of deleted records (overwrite mode), and lists of records that failed and succeeded during import. The format of this file is likely to change in a future release of Mac OS X. --password value is the admin's password for import operations. Used to authenticate to the directory node during import. A secure prompt will be used for interactive input if not supplied via parameter. Using the prompt method is the most secure method of providing password to dsimport. --recordformat string passes in the delimiters and attributes and record type to specify the order and names of attributes in the file to be imported. An example record format string: 0x0A 0x5C 0x3A 0x2C dsRecTypeStandard:Users 7 dsAttrTypeStandard:RecordName dsAttrTypeStandard:Password dsAttrTypeStandard:UniqueID dsAttrTypeStandard:PrimaryGroupID dsAttrTypeStandard:RealName dsAttrTypeStandard:NFSHomeDirectory dsAttrTypeStandard:UserShell A special value of IGNORE can be used for values that should be ignored in the import file on a record-by-record basis. --recordtype type Override the record type defined in the import file. For example, to import ComputerGroups as ComputerLists, use: --recordtype dsRecTypeStandard:ComputerLists The opposite works for importing ComputerLists as ComputerGroups, and so on. --remotehost hostname | ipaddress connects to a remote host at the network address specified. Commonly used to import to a remote Mac OS X Server. --remoteusername value specifies user name to use for the remote connection. --remotepassword value specifies password to use for the remote connection. A secure prompt will be used to ask for the password if --remoteusername is specified and --remotepassword is not. Using the prompt method is the most secure method of providing password to dsimport. --startid value indicates the ID number to start with when the import tool generates user or group IDs for any import file that lacks an ID as part of the import data. --template StandardUser | StandardGroup is used for delimited import of files that lack field descriptions. StandardUser contains the following fields in the order: 1. RecordName 2. Password 3. UniqueID 4. PrimaryGroupID 5. DistinguishedName 6. NFSHomeDirectory 7. UserShell StandardGroup contains the following fields in the order: 1. RecordName 2. Password 3. PrimaryGroupID 4. GroupMembership --username value is the admin username to use when importing records. If this is not specified the current user is the default name. Also, if used in conjunction with --remotehost then this admin user will be used for the Open Directory node whereas the username provided in --remoteusername will be used for the remote connection. If this option is left off but --remoteusername is provided, then the remote username will be used for both the connection and for importing records. --userpreset value designate a preset record to be applied to imported user records. EXAMPLES
To import a standard dsexport file into the Local database: dsimport myimportFile /Local/Default I --username administrator --password adminpassword FILES
/usr/bin/dsimport ~/Library/Logs/ImportExport SEE ALSO
DirectoryService(8) dsexport(1) Darwin May 31, 2019 Darwin
All times are GMT -4. The time now is 05:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy