03-10-2009
Need to remove improperly formatted fortran output line from files, tried sed
I have been trying to remove some improperly formatted lines of output from fortran code I have been using. The problem is that I have some singularities in the math for some points that causes an incorrectly large value to be reported that exceeds the normal formating set in the code resulting in lines that look like (from grep):
-0.97100 -0.23600 -0.02500 0.88100 0.04300 -0.09000 -0.46200 53.914 -8.322 6438515.46 ****************** -72.155
0.64200 0.39200 0.65900 -0.06000 -0.20700 0.70700 -0.67400 46.457 -11.697 148148132.06 ****************** -198.987
Some example lines from the output file given (copy/paste messes up the formating a little, but you can get the picture) :
-0.95000 -0.23700 -0.20300 0.95800 0.13100 -0.07700 -0.24500 61.773 -12.055 264623610.61 538566431.64 -0.638
-0.95000 -0.23700 -0.20300 0.14500 0.33300 0.91800 -0.16100 62.124 -8.243 11146893.11 9371267.73 0.596
-0.97000 -0.23700 -0.06100 -0.52100 -0.72400 0.40400 -0.20100 58.117 -9.802 29371877.18 28037325.06 0.377
-0.97100 -0.23600 -0.02500 0.19900 0.24100 0.83700 0.44900 56.976 -8.890 10397762.98 7138919.32 0.730
-0.97100 -0.23600 -0.02500 0.72400 0.55000 0.13000 -0.39500 56.133 -8.044 5082904.22 17628889.64 -1.201
-0.97100 -0.23600 -0.02500 0.88100 0.04300 -0.09000 -0.46200 53.914 -8.322 6438515.46 ****************** -72.155
-0.97100 -0.23600 0.04700 0.86000 -0.15400 0.15300 -0.46200 50.033 -9.237 15789713.77 12150348.57 0.898
-0.97100 -0.23600 0.04700 -0.11400 -0.69100 -0.20400 0.68400 49.677 -8.322 5778517.84 6907087.88 0.266
-0.97100 -0.23600 0.04700 0.10500 -0.58200 -0.44600 -0.67100 52.463 -8.556 8444383.37 4628898.08 0.893
What I have tried...
I can find all those lines that have the ***** problem using grep as
grep '*/*' file1 > file2
But I need to delete the lines from file1 so that when I redo the incorrect calculations with a more accurate, albeit much slower code, these are not present when using this output file as an input for another step.
Here are the variations of sed that I have used (and all do not work!)
sed '*/*/d' file1 > file1.keep
sed '/*/d' file1 > file1.keep
sed '/\*/d' file1 > file1.keep
sed '/\*\*\*/d' file1 > file1.keep
sed '/***/d' file1 > file1.keep
sed '/^\*/d' file1 > file1.keep
I may have tried some other variations but these are the ones I remember at the moment.
So can any one suggest a way to remove the lines with a matching **** using any scripting approach, i.e. sed, awk, etc.
Thanks
Chris
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Aloha! I have just over 1k of users that have permissions that they shouldn't under our system. I need to parse a provided list of usernames, check their permissions file, and strip the permissions that they are not allowed to have. If upon the permissions strip they are left with no permissions,... (6 Replies)
Discussion started by: Malumake
6 Replies
2. Shell Programming and Scripting
hello experts,
I need a sed command that remove last 10 characters of a line start from 3rd line.
any suggestions?
Thanks you (7 Replies)
Discussion started by: minifish
7 Replies
3. Shell Programming and Scripting
hey gents,
I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies
4. Solaris
Hi,
I wish to install solaris 10 on a target machine (t1000) by using Jumpstart. I have configured by jumpstart environment for the same. When i boot the target with the option "boot net -v install" i get the following error...
{0} ok boot net -v install
Boot device: /pci@7c0/pci@0/network@4... (3 Replies)
Discussion started by: hemalsid
3 Replies
5. Shell Programming and Scripting
Hello, there. I have a file that's a horrible, horrible mess. (Basically, it's an export from a firewall config.) The people who generated the file didn't think that putting a newline in the middle of a hostname would ever be a problem. It is.
Here's an example of the stuff in the file:
... (2 Replies)
Discussion started by: mikesimone
2 Replies
6. UNIX for Dummies Questions & Answers
Hello everyone,
This is my first posting. I have read the rules of this forum. I have searched many various threads and haven't found one that applies to my situation or suggestions to fix the issue. I do appreciate the help.
I am trying to execute a basic UNIX script in a Solaris... (4 Replies)
Discussion started by: dqrgk0
4 Replies
7. UNIX for Dummies Questions & Answers
I'm watching a particular expression as it is appended in a line to a file:
tail -f LOG | sed -n /"$@"/p
So whatever value I pass into this script will tail -f the file, but only show me lines that contain the value:
lgwatch expression
However some of the output contains a #20 control... (8 Replies)
Discussion started by: MaindotC
8 Replies
8. Shell Programming and Scripting
sed -e '1d' -e 's/^\(]\{2\}\)-\(]\{3\}\)-\(]\{4\}\).*/"0000020\1\200\3"\,/g' abc.txt
This script returns many duplicates due to the duplciates in the .txt file.
i.e.
...
"000002012149000060",
"000002012149000064",
"000002012149000064",
"000002012149000064",
"000002012149000064",... (9 Replies)
Discussion started by: Daniel Gate
9 Replies
9. Shell Programming and Scripting
Sed command to replace a line in a file using line number from the output of a pipe.
Is it possible to replace a whole line piped from someother command into a file at paritcular line...
here is some basic execution flow..
the line number is 412
lineNo=412
Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies
10. UNIX for Beginners Questions & Answers
Hi,
At the moment, using Notepad++ to do a search and replace, manually section by section which is real painful. Yeah, so copying each section of the line of text and putting into a file and then search and replace, need at least 3-operations in Notepad++.
Here's hoping I will be able to... (1 Reply)
Discussion started by: newbie_01
1 Replies
XZDIFF(1) XZ Utils XZDIFF(1)
NAME
xzcmp, xzdiff, lzcmp, lzdiff - compare compressed files
SYNOPSIS
xzcmp [cmp_options] file1 [file2]
xzdiff [diff_options] file1 [file2]
lzcmp [cmp_options] file1 [file2]
lzdiff [diff_options] file1 [file2]
DESCRIPTION
xzcmp and xdiff invoke cmp(1) or diff(1) on files compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed
directly to cmp or diff. If only one file is specified, then the files compared are file1 (which must have a suffix of a supported com-
pression format) and file1 from which the compression format suffix has been stripped. If two files are specified, then they are uncom-
pressed if necessary and fed to cmp(1) or diff(1). The exit status from cmp or diff is preserved.
The names lzcmp and lzdiff are provided for backward compatibility with LZMA Utils.
SEE ALSO
cmp(1), diff(1), xz(1), gzip(1), bzip2(1), zdiff(1)
BUGS
Messages from the cmp(1) or diff(1) programs refer to temporary filenames instead of those specified.
Tukaani 2009-07-05 XZDIFF(1)