![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to remove the specific lines from file using perl | dipakg | Shell Programming and Scripting | 4 | 06-11-2008 02:45 AM |
| Insert 2 lines in a file at a specific location | potro | Shell Programming and Scripting | 2 | 05-08-2008 07:38 PM |
| how to remove specific lines from a file | bluemoon1 | Shell Programming and Scripting | 17 | 10-07-2007 10:40 PM |
| Insert lines at specific location in file | hcclnoodles | Shell Programming and Scripting | 17 | 03-28-2007 08:00 AM |
| remove specific lines from a file | hcclnoodles | Shell Programming and Scripting | 14 | 09-07-2006 12:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Remove duplicates from File from specific location
How can i remove the duplicate lines from a file, for example
sample123456Sample testing123456testing XXXXX131323XXXXX YYYYY423432YYYYY fsdfdsf123456gsdfdsd all the duplicates from column 6-12 , must be deleted. I want to consider the first row, if same comes in the given range i want to delete the line. The output am expecting is sample123456Sample XXXXX131323XXXXX YYYYY423432YYYYY Thanks |
|
||||
|
Code:
awk 'NR==1{ get=substr($0,7,6);print $0 }
NR>1 && $0 !~ get{
print $0
}' file
|
| Sponsored Links | ||
|
|