08-12-2005
perl -e 'while (<>) { if (! /\|$/ ) { chomp; } print ;}' input.dat > output.dat
should work assuming the correct end of line is always preceeded with a '|' character.
If you have trailing spaces or suchlike on the lines then it needs a little modification.
This User Gave Thanks to Unbeliever For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to put the single line contents of a file into a variable, but remove the last character, for example the file would have this sort of contents:
2;4;3;10;67;54;96;
And I want the variable to be:
2;4;3;10;67;54;96 (notice the last ";" has gone).
Unfortunately I can't just... (4 Replies)
Discussion started by: danhodges99
4 Replies
2. UNIX for Dummies Questions & Answers
Here is a sample code
grep '903' -i user.txt | tail -2 | awk '{print $2}' | sed 's/B//g'
the input file has data as such
903-xxx-xxxxB
903-xxx-xxxxB
It is a dialer file i want to remove the "B"
any help thanks (5 Replies)
Discussion started by: Iz3k34l
5 Replies
3. Shell Programming and Scripting
Hello Experts,
I have a file "tt.txt" which is like:
#a1=a2
b1=b2
#c1=c2
I need to remove the pound (#) sign from a particular line. In this case let us assume it's 3rd line : "#c1=c2"
I can do it through:
sed "s/#c1=c2/c1=c2/" tt.txtbut it is possible that I may not know the value... (6 Replies)
Discussion started by: hkansal
6 Replies
4. HP-UX
Hi Experts,
I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line.
File is comma (,) seperated.
Eg:
ID,Client ,SNo,Rank
37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies
5. Shell Programming and Scripting
Hi everyone,
I'm very new to using sed, run through some tutorials and everything but I've hit a problem that I'm unable to solve by myself.
I need to remove all linefeeds that are followed by a particular character (in this case a semicolon). So basically, all lines starting with a semicolon... (5 Replies)
Discussion started by: fluffdasheep
5 Replies
6. Shell Programming and Scripting
Hi,
I have a file with lines such as the below. I want to remove the comma only if it is the first character on a line. I can't work out how to do this using sed.
*ELSET, ELSET=WHEEL_TD2
63, 64, 65, 72, 82, 88, 89, 92, 120, 121, 152, 181, 190, 221, 252, 259
, 260, 282, 283, 285, 286,... (2 Replies)
Discussion started by: carlr
2 Replies
7. Shell Programming and Scripting
Good afternoon:
im working wih 2 files to find differences and use the cmp command
cmp file1 file2
file1 file2 are are diifferent char 302 line1
i found what the difference is with the sed command and that is the file1 at the end of every line has a (,) (comma) character.
i.e
sed -n... (4 Replies)
Discussion started by: alexcol
4 Replies
8. UNIX for Dummies Questions & Answers
Hi guys,
Does anyone know how to remove the last character in each of the line?
This is what I have:
ABCDE.1
GLSJD.2
HIJPL.2
HKAGB.3
IUBWQ.1
What I want (remove the dot and number):
ABCDE
GLSJD
HIJPL
HKAGB
IUBWQ
I tried to use this: sed 's/.*//'
But I'm not sure if that is... (3 Replies)
Discussion started by: narachaid
3 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
Could any one suggest how to remove $ symbol in a text file when i am opening in vi editor.
Scenario;
For example iam having a file name aaa.txt the data inside the file is like
sample
name
when i am opening in vi editor
The same file resembles like below when i am... (1 Reply)
Discussion started by: Chandru_Raj
1 Replies
10. Shell Programming and Scripting
Hi,
I am a newbie to shell scripting (.sh). Please guide me on how to do the below issue.
My input file has below data.
I want to remove $ sysmbol from the fourth column of each line. (ie, between 4th and 5th pipe symbol)
ABC25160|51497|06/02/2010|$32,192.07|MARK|$100|A... (3 Replies)
Discussion started by: rsreejithmenon
3 Replies
geom(1) geom(1)
NAME
geom - analyzes a molecular geometry input in Cartesian coordinates.
DESCRIPTION
The program geom reads a set of Cartesian coordinates and determines from them the bond distances (Bohr and angstrom), bond angles, tor-
sional angles, out-of-plane angles (optional), moments of inertia, and rotational constants.
FILES REQUIRED
input.dat - Input file
and one of the following:
geom.dat - geometry file
file11.dat - PSI-format geometry/gradient file
FILES GENERATED
geom.out - file containing the analysis
INPUT OPTIONS
The geom program has the following options:
-h Print help information (these options).
-aces [filename]
Read the input in an ACES output format, with each line consisting of atomic symbol, atomic number, and Cartesian coordinates (in
Bohr). The optional argument is the name of the geometry input file, which defaults to geom.dat.
-qchem [filename]
Read the input in an QCHEM output format, with each line consisting of the atom number, the atomic symbol, and Cartesian coordinates
(in Angstroms). The optional argument is the name of the geometry input file, which defaults to geom.dat.
-xyz [filename]
Read the input in an XYZ output format. The first line contains the number of atoms and the second line is a comment line. Subse-
quent lines each contain the atomic symbol and Cartesian X Y and Z coordinates (in Angstroms). The optional argument is the name of
the geometry input file, which defaults to geom.dat.
-oop Print out-of-plane angles, where the angle a-b-c-d is defined as the angle formed by the vector a-d and the plane defined by atoms
b, c, and d.
DO_OOP = boolean
Same as command-line switch -oop described above.
ISOTOPES = matrix of reals/strings
Used to specify masses to be used in the calculation of the center of mass and rotational constants. One array is provided for each
isotopomer to be calculated. The arrays can mix floating point numbers with strings which designate isotopes. If this array is not
given and file11.dat is present, then the masses will be obtained by converting the atomic numbers in file11. If masses are not
given by ISOTOPES or by file11, then no mass-related quantities will be calculated.
-g [filename]
Read Cartesian coordinates from a file other than file11.dat. If a filename is not given, the default is geom.dat. The alternative
file is assumed to be in a format similar to that of PSI's geom.dat. Since such files do not contain atomic numbers, the moments of
inertia and rotational constants are not calculated if this option is used.
READ_GEOM = boolean
This option in input.dat tells geom to read the geometry from geom.dat in the PSI geom.dat format.
-a Print parameters for all pair distances.
PRINT_ALL_DIST = boolean
Same as -a flag described above.
-d distance
Only print parameters involving pairs of atoms which are less than distance bohr apart (default value is 4.0 bohr).
PRINT_DISTANCE = value
Same as -d flag described above.
-angstrom
The input coordinates are in angstroms, not bohr.
ANGSTROM = boolean
If TRUE, the input coordinates are in angstroms instead of bohr. The default is FALSE.
The following example is for calculating the geometrical information for water with several different isotopes. The geometry is
read from geom.dat rather than from file11.dat.
geom: (
read_geom = true
isotopes = (
(O H H)
(O D D)
(O18 1.007825 1.007825)
) )
5 June, 1998 geom(1)