01-08-2007
How to strip non numerical data out of file?
Hi,
How can I remove all non numerical data from line, so I don't want to delete the line but to have only the numbers.
e.g.:
#########
123
aaa124
125bbb
126
127
#########
So I want all the leading and trailing non numerical stuff(letters/white space/tabs anything else except [0-9]) stripped.
So from above I would get:
#########
123
124
125
126
127
#########
Thanks a lot for your help!
//Juha
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to remove or replace various extraneous characters from a file so that subsequent processes work correctly. The characters that is giving me trouble is the apostrophe '.
The command I 'm trying is
sed 's/\'//g' ${IN_WRK_DIR}/file1 > ${IN_WRK_DIR}/file2
in a Korn script on HP... (8 Replies)
Discussion started by: aquimby
8 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have some EDI data which 830, 862 and 997. Here is the sample data:
ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051215~184
3~U~00200~000011432~0~P~<
GS~FA~TC11A~U1CAD~051215~1843~000011432~X~002002
ST~997~0001
AK1~SH~1168
AK2~856~11680001
AK5~A... (2 Replies)
Discussion started by: isingh786
2 Replies
3. Programming
Hi I was hoping that maybe someone could help me with a small piece of C code. I have a number of files, which are all of similar layout ie. three lines of text and 5-6 columns of numerical data. I need to add each of the elements of the second column in one file to their counterparts in the second... (17 Replies)
Discussion started by: Boucho
17 Replies
4. Shell Programming and Scripting
Hi,
I've searched and couldn't find anyone else with this problem. Is there anyway (preferably using ksh - but other script languages would do) that I can read in binary float data into a text file. The data (arrays from various stages of radar processing) comes in various formats, but mainly... (3 Replies)
Discussion started by: Jonny2Vests
3 Replies
5. Shell Programming and Scripting
So, I will be working with someone and basically we are trying to build a form that is submitted most likely via the web and the data is just a string of numbers.
like:
19383882872201110929282821818182827349190102837364718191001932873711
Now, each number is part of a numerical value of... (4 Replies)
Discussion started by: tlarkin
4 Replies
6. Shell Programming and Scripting
Hi everyone,
I hope someone can help me:
i am trying to get some info from a csv file, after i awk the column i need , i made a selection and output it in a file.
now i need to get a list from this file, but i stuck with some fields.
basically i have a text file with next data:
3... (3 Replies)
Discussion started by: lostym
3 Replies
7. Shell Programming and Scripting
Hi experts,
I have a list of files containing forces as the only number as follows.
Force1.txt Force2.txt Force3.txt Force4.txt Force5.txt . . . . . . . . . Force100.txt I want to put all the data(only a number ) in these forces files in the file with the same order like 1,2,3 ..100 .... (2 Replies)
Discussion started by: hamnsan
2 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I have two files, f1 and f2. f1 has 5 columns like so:
a b c d 154
e f g h 365
.....
f2 has two columns, the first column contains the name of the above file and second column contains a constant which is to be used for division.
e.g.
file1 56
I want to divide the 5th... (2 Replies)
Discussion started by: Gussifinknottle
2 Replies
STDA(1) User Commands STDA(1)
NAME
stda - Simple Tools for Data Analysis (STDA)
DESCRIPTION
STDA includes some primary tools for data analysis. You can evaluate sums, averages, integrals, derivatives, histograms or probability dis-
tribution functions of 1-d data, and eventually plot the results. The programs are stand-alone tools (supporting the standard UNIX input
and output pipelines) intended for data processing from the command line. It should be noted that all but one of the scripts use awk and
core system utilities. For plotting you have to install Gnuplot (see http://gnuplot.info) since 'muplot' is a wrapper around it. In sum-
mary, the package provides utilities for straightforward analysis of data series where a complex analytical approach is not needed and
where an ultimate numerical precision with floating-point numbers is not critical. Some general examples of application cases include eval-
uating usage statistics from server logfiles, determining a response time distribution from a series of queries to a [remote] service, pro-
ducing a plot from multiple data files, etc.
This software should be considered as an open project to be extended with new command-line driven utilities helpful for performing common
data analysis tasks. Any contributions and suggestions are welcome.
Following programs are included in the distribution:
* maphimbu - histogram builder for 1-d numerical and text data
* mintegrate - average/sum/integral/derivative of 1-d numerical data
* mmval - find minimum and maximum value in a data set
* muplot - plot a multi-curve figure from multiple data by using Gnuplot
* nnum - produce a series of equally separated integers or floats
* prefield - prepare input file for 'muplot' to plot 2-d fields by arrows
EXAMPLES
- Evaluate the current apache2 logfile and make an unique list of the hostnames (respectively ip-addresses) sorted by the total number of
their http requests:
maphimbu -rs2 /var/log/apache2/access.log
- On a X terminal plot the probability function and the cumulative distribution function of a sin(x) data sample:
nnum -3.14159 3.14159 0.00001 %.6g |awk '{ print $1, sin($1) }' | maphimbu -d0.01 -x2 -ns1 |mintegrate -d0.01 -x1 -y3 -S |muplot
lp - 1:3,4
COPYRIGHT
Copyright (C) 2009, 2011-2012 Dimitar Ivanov <dimitar.ivanov@mirendom.net>
License: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
stda 1.1.1 February 2012 STDA(1)