The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell programming nivas Shell Programming and Scripting 8 02-11-2008 09:06 AM
Aix Shell Programming akmtcs AIX 1 12-07-2006 05:40 AM
shell programming Neha Agarwal Shell Programming and Scripting 2 09-06-2005 11:23 PM
Shell Programming Help mec585858 UNIX for Dummies Questions & Answers 4 12-10-2003 07:24 AM
Shell Programming JWK1 UNIX for Dummies Questions & Answers 2 06-01-2001 10:31 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-30-2008
nivas
Guest
 

Posts: n/a
Shell programming

Hi,

Iam new to shell program,

I want to check a file which is having same lines 2 times and i want to display it in a seperate file.

File format is :

AQWERTYU|1234567890
ASDFGHJK|0987654321
ZXCVBNML|1098576453
AQWERTYU|1234567890

I need to take the 1st and 4th lines in the above file and write it in to seperate file.
Please help me.

Thanks in advance
Reply With Quote
Forum Sponsor
  #2  
Old 01-30-2008
nivas
Guest
 

Posts: n/a
sorry i need to take 1st and 4th line in the above file.
Reply With Quote
  #3  
Old 01-30-2008
Registered User
 

Join Date: Jun 2007
Location: Beijing China
Posts: 495
hi!!!

Try this one

Code:
for i in `uniq -d filename`
do
grep $i b
done > result.temp
Reply With Quote
  #4  
Old 01-30-2008
nivas
Guest
 

Posts: n/a
Shell programming

Here what is b in the given sample code ...Pls help me??
Reply With Quote
  #5  
Old 01-30-2008
Registered User
 

Join Date: Sep 2006
Posts: 1,580
Code:
# sort file | uniq -D
AQWERTYU|1234567890
AQWERTYU|1234567890
Reply With Quote
  #6  
Old 01-31-2008
nivas
Guest
 

Posts: n/a
Shell programming

Thanks a lot.. .it is working fine.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0