Sponsored Content
Top Forums Shell Programming and Scripting script to sort a string of numerical data in set fields Post 302397373 by amitranjansahu on Monday 22nd of February 2010 02:00:37 AM
Old 02-22-2010
Here is the basic code

Code:
cd "your path where your files are"

DESTPATH="Your dest path"
for filename in *;
do
    
X=`cat $filename |cut -c1-5`
Y=`cat $filename |cut -c6-13`
Z=`cat $filename |cut -c14-16`

echo "A = $X" > /DESTPATH/$filename.new
echo "B = $Y" >> /DESTPATH/$filename.new
echo "C= $Z" >> /DESTPATH/$filename.new
done

 

9 More Discussions You Might Find Interesting

1. Programming

Adding files of numerical data

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

2. Shell Programming and Scripting

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... (10 Replies)
Discussion started by: Juha
10 Replies

3. Shell Programming and Scripting

Script to sort data

Hi All, I have a .csv file with 3 columns called nLats, nLongs, and fRes. in following format : "nLats","nLongs","fRes" 0,0,-1 0,1,-1 0,2,-1 0,3,-1 0,4,-1 ......... ......... 0,143,-1 nLats increments at nLongs=143 1,0, -1 1,1, -1 .......... .......... 1,143,-1... (1 Reply)
Discussion started by: wizardy_maximus
1 Replies

4. Shell Programming and Scripting

Reading Numerical Binary Data using KSH

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

Sort numerically a non numerical

Hello, I have this sample data: 01 * * * * 01 * * * * 01 * * * * 01 * * * * 01 0 * * * 01 0 * * * 01 0 * * * 01 0 * * * 02 * * * 0 02 * * * 0 02 * * * 6 02 * * * 6 02 0 * * 1 02 0 * * 1 02 0 * * 2 02 0 * * 2 02 0 * * 3 (3 Replies)
Discussion started by: gio001
3 Replies

6. UNIX for Dummies Questions & Answers

How to sort a column based on numerical ascending order if it includes e-10?

I have a column of numbers in the following format: 1.722e-05 2.018e-05 2.548e-05 2.747e-05 7.897e-05 4.016e-05 4.613e-05 4.613e-05 5.151e-05 5.151e-05 5.151e-05 6.1e-05 6.254e-05 7.04e-05 7.12e-05 7.12e-05 (6 Replies)
Discussion started by: evelibertine
6 Replies

7. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

8. Shell Programming and Scripting

Use sort to sort numerical column

How to sort the following output based on lowest to highest BE? The following sort does not work. $ sort -t. -k1,1n -k2,2n bfd.txt BE31.116 0s 0s DOWN DAMP BE31.116 0s 0s DOWN DAMP BE31.117 0s 0s ... (7 Replies)
Discussion started by: sand1234
7 Replies

9. Shell Programming and Scripting

Sort file data according to a custom list of string

I have a string of pre defined ip address list which will always remain constant their order will never change like in below sample: iplist=8.8.5.19,9.7.5.14,12.9.9.23,8.8.8.14,144.1.113 In the above example i m considering only 5 ips but there could be many more. Now i have a file which... (15 Replies)
Discussion started by: mohtashims
15 Replies
dtinfoaction(file formats)												dtinfoaction(file formats)

NAME
dtinfoaction -- CDE information management actions SYNOPSIS
DtLoadInfoLib filename Open filename DtShowInfoAtLoc DtPrintInfoAtLoc DESCRIPTION
The CDE Information Management Services support the following information management actions: DtLoadInfoLib filename Load the information library specified by filename, which can be either a relative or absolute file path. If filename is not specified, dtinfo displays the default information library(s). Open filename Load the information library specified by filename. Remaps to DtLoadInfoLib filename. DtShowInfoAtLoc filename section Display the section or topic specified by section contained within the infolib specified by filename. filename can be either a relative or absolute file path. section specifies the information library section in generalized locator format. dtinfo is started if it is not already running. This corresponds to invoking dtinfo with the -sect option from the command line. DtPrintInfoAtLoc Print one or more infolib sections from the desktop. This action is invoked whenever a section or sections is dragged from the book list window in dtinfo and dropped on the printer icon on the front panel. These actions can be invoked from an application using the DtActionInvoke(3) function or invoked from a command line using the dtaction(1) utility. SEE ALSO
dtinfo(1), DtActionInvoke(3), DtInfo_LoadInfoLib(4), DtInfo_PrintInfoAtLoc(4), DtInfo_ShowInfoAtLoc 4 dtinfoaction(file formats)
All times are GMT -4. The time now is 04:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy