awk '
function rbefore(STR) { return(substr(STR, 0, RSTART-1)); }# before match
function rall(STR) { return(substr(STR, RSTART, RLENGTH)); }# Entire match
function rafter(STR) { return(substr(STR, RSTART+RLENGTH)); }# after
# First line: Reformat headers for sorting and find new order
NR==1 {
for(N=1; N<=NF; N++)
{
IN=$N
OUT=""
# Convert a_3 to a_00000003 so it will sort
while(match(IN, /[0-9]+/))
{
OUT=OUT rbefore(IN) sprintf("%08d", rall(IN));
IN=rafter(IN);
}
OUT=OUT IN;
A[OUT]=N # Creating an array of A["string_0001"]=N
}
C=asorti(A, B); # Sort it into B[1]="string_0001", B[2]="string_0003" etc
for(X in B) D[X]=A[B[X]]; # D[1]=4, maps in to out column
}
# All lines: Assemble string from column order and print
{
OUT=""
for(N=1; N<=C; N++) OUT=OUT OFS $(D[N])
print substr(OUT,2);
}
' FS=";" OFS=";" inputfile > outputfile
Hi,
I have a comma delimited file. I want to sort the fields alphabetically and again store them in a comma delimited file.
For example, My file looks like this.
abc,aaa,xyz,xxx,def
pqr,ggg,eee,iii,qqq
zyx,lmo,pqr,abc,fff
and I want my output to look like this, all fields sorted... (3 Replies)
I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want.
The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
I have a large flat file with variable length fields that are pipe delimited. The file has no new line or CR/LF characters to indicate a new record. I need to parse the file and after some number of fields, I need to insert a CR/LF to start the next record.
Input file ... (2 Replies)
Gents,
I have a large file and each line of the file contains more than 200 bytes.Please let me a way to have the new line to start when the word "FIT" appears.
I was trialling with 'tr' command but i am not sure how to get it based on bytes and so it wasn't working...
Current... (3 Replies)
I'm facing a strange problem, please help me out.
Here we go.
I want to count number of fields in particular file.
filename and delimiter character will be passed through parameter.
On command prompt if i type following i get 27 as output (which is correct)
cat customer.dat | head -1 | awk... (12 Replies)
Hi,
I have a comma (,) delimited file, in which few fields are enclosed with in double quotes " ". I have to print the records in the file which donot have expected number of field with the line number.
File1
====
name,desgnation,doj,project #header#... (7 Replies)
Hi,
I need your help for below with shell scripting or perl
I/P
key, Sentence
customer1, I am David
customer2, I am Taylor
O/P
Key, Words
Customer1,I
Customer1,am
Customer1,David
Customer2,I
Customer2,am
Customer2,Taylor (4 Replies)
Hi,
I am required to arrange columns of a file i.e make the 15th column into the 1st column.
I am doing
awk 'begin {fs=ofs=","} {print $15,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' ad.data>ad.csv
the problem is that column 15 gets to column 1 but it is not comma separated with the... (10 Replies)
Hi, I have a rquirement in unix as below .
I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column.
ex:
Input Text file:
1|A|apple
2|B|bottle
excel file to be generated as output as... (9 Replies)
For an Output like below
Input : <Subject A="I" B="1039502" C="2015-06-30" D="010101010101">
Output : <Subject D="010101010101" B="1039502" C="2015-06-30" A="I">
I have been using something like below but not getting the desired output :
awk -F ' ' '/Subject/ BEGIN{OFS=" ";}... (19 Replies)
Discussion started by: arunkesi
19 Replies
LEARN ABOUT DEBIAN
od2trips
SUMO(1) User Commands SUMO(1)NAME
SUMO - Importer of O/D-matrices for the road traffic simulation SUMO
SYNOPSIS
od2trips [OPTION]*
DESCRIPTION
SUMO od2trips Version 0.15.0
Copyright (C) 2001-2012 DLR and contributors; http://sumo.sourceforge.net
Importer of O/D-matrices for the road traffic simulation SUMO.
Configuration Options:
-c, --configuration-file FILE
Loads the named config on startup
--save-configuration FILE
Saves current configuration into FILE
--save-template FILE
Saves a configuration template (empty) into FILE
--save-schema FILE
Saves the configuration schema into FILE
--save-commented
Adds comments to saved template, configuration, or schema
Input Options:
-n, --net-file FILE
Loads network (districts) from FILE
-d, --od-matrix-files FILE
Loads O/D-files from FILE(s)
Output Options:
-o, --output-file FILE
Writes trip definitions into FILE
--ignore-vehicle-type
Does not save vtype information
Time Options:
-b, --begin TIME
Defines the begin time; Previous trips will be discarded
-e, --end TIME
Defines the end time; Later trips will be discarded; Defaults to the maximum time that SUMO can represent
Processing Options:
-s, --scale FLOAT
Scales the loaded flows by FLOAT
--spread.uniform
Spreads trips uniformly over each time period
--vtype STR
Defines the name of the vehicle type to use
--prefix STR
Defines the prefix for vehicle names
--timeline STR
Uses STR as a timeline definition
--timeline.day-in-hours
Uses STR as a 24h-timeline definition
--dismiss-loading-errors
Continue on broken input
--no-step-log
Disable console output of current time step
Defaults Options:
--departlane STR
Assigns a default depart lane
--departpos STR
Assigns a default depart position
--departspeed STR
Assigns a default depart speed
--arrivallane STR
Assigns a default arrival lane
--arrivalpos STR
Assigns a default arrival position
--arrivalspeed STR
Assigns a default arrival speed
Report Options:
-v, --verbose
Switches to verbose output
-p, --print-options
Prints option values before processing
-?, --help
Prints this screen
-V, --version
Prints the current version
-W, --no-warnings
Disables output of warnings
-l, --log FILE
Writes all messages to FILE (implies verbose)
--message-log FILE
Writes all non-error messages to FILE (implies verbose)
--error-log FILE
Writes all warnings and errors to FILE
Random Number Options:
--random
Initialises the random number generator with the current system time
--seed INT
Initialises the random number generator with the given value
EXAMPLES
od2trips -c <CONFIGURATION>
run with configuration file
REPORTING BUGS
Report bugs at <http://sourceforge.net/apps/trac/sumo/>.
Get in contact via <sumo-user@lists.sourceforge.net>.
Copyright (C) 2001-2012 DLR and contributors; http://sumo.sourceforge.net
SUMO od2trips Version 0.15.0 is part of SUMO.
SUMO is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/gpl.html
SUMO od2trips Version 0.15.0 May 2012 SUMO(1)