I have tried the code posted by both RavinderSingh13 and Don Cragun and both work with the examples I have tested on openSuse 13.2 x86_64.
There doesn't seem to be any difference in performance.
I haven't been able to try the csvtool and recut suggestions posted by drl because I don't have either tool installed. Both of these tools appear to have an elegant and intuitive syntax for this kind of thing. It looks like csvtool is available in the default repositories but recut is not. I generally lean towards using awk and sed because they are always available. It looks like you need all of textlive to get csvtool, which is too bad because textlive is about 1500 packages.
---------- Post updated at 01:30 PM ---------- Previous update was at 12:23 PM ----------
It looks like I also need to add another column to the end of the file. The column would be named "target" and would have the same value for every row. The row values would be floating point numbers like 0.0 or 1.0.
For example, add a column "target" to the end
To look like this
The only way I can think of to do this is to generate a second file with the new column and then paste the files together.
This more or less works, but are there any suggestions for a better way?
LMHmedchem
Last edited by LMHmedchem; 11-28-2016 at 02:51 PM..
hi!
in awk, i have a file like this:
Trace1: WRIT,Trace2: BLAN,Trace3: BLAN,
-47.2120018005371,,,39815.4809027778
-46.3009986877441,,,39815.4809027778
-46.277000427246,,,39815.4809143519
-46.7389984130859,,,39815.4809259259
-46.3460006713867,,,39815.4809259259... (10 Replies)
Hello.
I have data in the following format (the spaces at the beginning of lines are included):
1 2
2 0.39621 0.00000
1 2
2 0.00000+-0.0000 *
1 2
... (5 Replies)
Hi,
I am new to shell scripting, i have requirement can any one help me out in this regrads,
in directory i have file like invoice1.txt, invoice2.txt in each file i have fixed number of columns, 62 in number but they are randomly arranged.like
for first file invoice1.txt can have columns... (5 Replies)
my $branch_email_e = $FORM{r_Branch};
my $hostbranch_email_e = $FORM{r_Host_Branch};
my $branch_email_f = $FORM{r_Direction_generale};
my $hostbranch_email_f = $FORM{r_Direction_generale_daccueil};
my $branch_realname_e = '';
my $branch_realname_f = '';
... (4 Replies)
Greetings,
I'm doing a process whereby I need to search for all filenames containing a given bit of text and grab the newest file from what may be 20 results. In a script I'm writing,
i've got a monster line to do the sort as follows:
find /opt/work/reports/input -name "*$searchtarget*" |... (4 Replies)
I have a script that runs once per month. It performs a certain task ONLY if the month is January, April, July, or October.
MONTH=`date +%m`
if || || || ; then
do something
else
do a different thing
fi
Is there a neater way of doing it than my four separate "or" comparisons? That... (2 Replies)
$ cat data
Do NOT print me
START_MARKER
Print Me
END_MARKER
Do NOT print me
$ cat awk.sh
start=START_MARKER
end=END_MARKER
echo; echo Is this ugly syntax the only way?
awk '/'"$start"'/,/'"$end"'/ { print }' data
echo; echo Is there some modification of this that would work?
awk... (2 Replies)
greetings,
to be clear, i have a solution but i'm wondering if anyone has a cleaner way to accomplish the following:
the variable:
LSB_MCPU_HOSTS='t70c7n120 16 t70c7n121 16 t70c7n122 16 t70c7n123 16 t70c7n124 16 t70c7n125 16 t70c7n126 16 t70c7n127 16 t70c7n128 16 t70c7n129 16 t70c7n130 16... (2 Replies)
Hi Folks,
I have just spent a couple of days resolving some problems at the remote DR data centre, sorting out the problems caused by the over zealous use of a Vacuum cleaner of all things.
We have a backup server a SUN V480R with a Storedge 3510 and expansion attached which suffered a... (6 Replies)