Sponsored Content
Top Forums Shell Programming and Scripting Remove regularly repeated lines Post 302751155 by saeed.soltani on Thursday 3rd of January 2013 09:14:51 AM
Old 01-03-2013
Remove regularly repeated lines

How can i delete some regular repeated lines in a file?
example:
in_file

Code:
EDGE 1 2 12
EDGE 2 3 23
EDGE 3 4 34
EDGE 5 6 56
EDGE 6 7 67
EDGE 7 8 78
EDGE 9 10 910
EDGE 10 11 1011
EDGE 11 12 1112
EDGE 13 14 1314
EDGE 14 15 1415
EDGE 15 16 1516
EDGE 17 18 1718
EDGE 18 19 1819
EDGE 19 20 1920
EDGE 21 22 2122
EDGE 22 23 2223
EDGE 23 24 2324
EDGE 25 26 2526
...

i want remove each 3 lines together after 5 line passed, so the result of that action in this example would be :
Code:
EDGE 1 2 12
EDGE 2 3 23
EDGE 3 4 34
EDGE 5 6 56
EDGE 6 7 67

EDGE 11 12 1112
EDGE 13 14 1314
EDGE 14 15 1415
EDGE 15 16 1516
EDGE 17 18 1718

EDGE 22 23 2223
EDGE 23 24 2324
EDGE 25 26 2526
...


Last edited by Scrutinizer; 01-04-2013 at 12:45 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove repeated line using Perl

I am new to Perl and in text file of around 1000 lines having around 500 repeated line which I felt is no use and want to remove these line.so can somebody help in same for providing sample code how can i remove these repeated line in a file. (11 Replies)
Discussion started by: dinesh.4126
11 Replies

2. Shell Programming and Scripting

remove anything after repeated string pattern found

HI, Can anyone help me with a script. i/p calc 1 2 3 4 5 6 7 8 calc 4 5 6 calc 7 8 9 o/p calc 1 2 3 4 5 6 7 8 calc 4 5 6 i.e remove anything after where two times the string calc is found. thanks (3 Replies)
Discussion started by: Indra2011
3 Replies

3. Shell Programming and Scripting

remove brackets and put it in a column and remove repeated entry

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (2 Replies)
Discussion started by: manigrover
2 Replies

4. Shell Programming and Scripting

need to print lines between repeated pattern

Hi all, I have a file that looks like this: uid=bessemsj version: 1 dn: cn=Desk SpecialAdminDesk, ou=Desks, dc=DSS,c=nl,o=Vodafone dn: cn=DSS Advisors, ou=Groups, dc=DSS,c=nl,o=Vodafone dn: cn=DSS Dispatcher,ou=Groups,dc=DSS,c=nl,o=Vodafone dn: cn=Desk Retention Desk,ou=Desks,... (13 Replies)
Discussion started by: Eman_in_forum
13 Replies

5. Shell Programming and Scripting

ksh Remove and replace repeated in file

Hi, i need to read a line from a file and count the number of times it appear in, then continuous to the second line with the same. So when i count a line i have to remove all duplicates in the file to not count it another time. while read line do n=$(grep -c $line File) print "$line... (5 Replies)
Discussion started by: ToniX
5 Replies

6. Shell Programming and Scripting

Getting most repeated 3 lines

Hi all if i want to get the 3 lines of the most repeated lines here tony,1,x tony,1,x tony,2,x tony,2,x tony,3,x tony,4,x tony,5,x adam,1,y to get output tony,1,x tony,2,x tony3,x adam,1,y (3 Replies)
Discussion started by: teefa
3 Replies

7. Shell Programming and Scripting

Compare two files with repeated lines

Hi all, I've been trying to write a script to compare two files. This is what I want: file 1: a 1 2 b 5 9 c 4 7 file 2: a a c a b Output: a 1 2 a 1 2 (2 Replies)
Discussion started by: ernesto561
2 Replies

8. Shell Programming and Scripting

Repeated lines-case sensitive

Hi, users file contains below names i have a requirement to keep only one case sensitive user. For e.g if user name is "aaa" then only aaa should be there in the file and other matching users(AAA,aaA) should be deleted. Tried multiple options but no luck can you please help. aaa abc AAA... (2 Replies)
Discussion started by: Satyak
2 Replies

9. Shell Programming and Scripting

Remove repeated letter words

Hi, I have this text file with these words and I need help with removing words with repeated letter from these lines. 1 ama 5 bib 29 bob 2 bub 5 civic 2 dad 10 deed 1 denned 335 did 1 eeee 1 eeeee 2 eke 8... (4 Replies)
Discussion started by: crepe6
4 Replies

10. Shell Programming and Scripting

Remove duplicate lines which has been repeated 4 times

Remove duplicate lines which has been repeated 4 times attached test.txt below command tried and not getting expect output. for i in `cat test.txt | uniq` do num=`cat test.txt | grep $i | wc -l` echo $i $num done test.txt ... (17 Replies)
Discussion started by: Kalia
17 Replies
Xray::Absorption::Henke(3pm)				User Contributed Perl Documentation			      Xray::Absorption::Henke(3pm)

NAME
Xray::Absorption::Henke - Perl interface to the Henke tables SYNOPSIS
use Xray::Absorption; Xray::Absorption -> load("henke"); See the documentation for Xray::Absorption for details. DESCRIPTION
This module is inherited by the Xray::Absorption module and provides access to the data contained in the Henke tables of anomalous scattering factors and line and edge energies. The data in this module, referred to as "The Henke Tables", was published as B. L. Henke, E. M. Gullikson, and J. C. Davis, Atomic Data and Nuclear Data Tables Vol. 54 No. 2 (July 1993). The Henke data is available on the web at http://www-cxro.lbl.gov/optical_constants/ and more information about the data can be obtained from Eric Gullikson <EMGullikson@lbl.gov>. The data is contained in a database file called henke.db which is generated at install time from the flat text files of the Henke data. The data is stored in a Storable archive using "network" ordering. This allows speedy disk and memory access along with network and platform portability. The required "File::Spec", "Chemistry::Elements", "Storable", modules are available from CPAN. METHODS
The behaviour of the methods in this module is a bit different from other modules used by "Xray::Absorption". This section describes methods which behave differently for this data resource. "get_energy" Example: $energy = Xray::Absorption -> get_energy($elem, $edge); This behaves similarly to the "get_energy" method of the other resources. When using the Henke data resource, $edge can be any of K, L1-L3, M1-M5, N1-N7, O1-O7, or P1-P3. Line energies are not supplied with the Henke data set. The line energies from the McMaster tables are used. "cross_section" Examples: $xsec = Xray::Absorption -> cross_section($elem, $energy, $mode); @xsec = Xray::Absorption -> cross_section($elem, @energy, $mode); This behaves slightly differently from the similar method for the McMaster and Elam resources. The Henke tables are actually tables of anomalous scattering factors and do not come with coherent and incoherent scattering cross-sections. The photo-electric cross-section is calculated from the imaginary part of the anomalous scattering by the formula mu = 2 * r_e * lambda * conv * f_2 where, "r_e" is the classical electron radius, lamdba is the photon wavelength, and conv is a units conversion factor. r_e = 2.817938 x 10^-15 m lambda = 2 pi hbar c / energy hbar*c = 1973.27053324 eV*Angstrom conv = Avagadro / atomic weight = 6.022045e7 / weight in cgs The $mode argument is different here than for the other resources. The options are "xsec", "f1", and "f2", telling this method to return the cross-section or the real or imaginary anomalous scattering factor, respectively. The values for f1 and f2 are computed by linear interpolation of a semi-log scale. Care is taken to avoid the discontinuities at the edges. Because the Henke tables do not include the coherent and incoherent scattering terms, the value returned by "get_energy" may be a bit smaller using the Henke tables than that from the McMaster tables. EDGE AND LINE ENERGIES
The Henke data resource provides a fairly complete set of edge energies. Any edge tabulated on the Gwyn William's Table of Electron Binding Energies for the Elements (that's the one published by NSLS and on the door of just about every hutch at NSLS) is in the Henke data resource. The Henke data comes with the same, limited set of fluorescence energies as McMaster. BUGS AND THINGS TO DO
o It would be nice to improve the inter-/extrapolation near absorption edges. As it stands, these tables produce really poor DAFS output. AUTHOR
Bruce Ravel, bruce@phys.washington.edu http://feff.phys.washington.edu/~ravel/ perl v5.12.4 2011-07-30 Xray::Absorption::Henke(3pm)
All times are GMT -4. The time now is 11:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy