Search Results

Search: Posts Made By: Ghetz
1,422
Posted By Ghetz
Many thanks pravin27, Your code works...
Many thanks pravin27,

Your code works beautifully.

Regards,

Ghetz
1,422
Posted By Ghetz
Dear pravin27 First many thanks for your...
Dear pravin27

First many thanks for your reply.

I tried your code replacing "sortfile" with "input_file":

sort -nk2,1 sortfile | awk 'NR==FNR{if(s!=$1){j=0;s=$1}a[$1]=++j;next}...
1,422
Posted By Ghetz
Appending lines with word frequencies, ordering and indexing a column
Dear All,

I have the following input data:

w1 20 g1
w1 10 g1
w2 12 g1
w2 23 g1
w3 10 g1
w3 17 g1
w3 12.5 g1
w3 21 g1
w4 11 g1
w4 13.2 g1
w4 23 g1
w4 18 g1


First I seek to find...
52,753
Posted By Ghetz
After some research and trial an error, this...
After some research and trial an error, this seems to produce the required output:
awk 'NR==FNR{a[tolower($1FS$2)]=$0;next}a[tolower($1FS$2)]{print "\42",...
52,753
Posted By Ghetz
Hi danmero, Thanks for your latest code - it...
Hi danmero,
Thanks for your latest code - it works fine.

I have been playing round with it to give the output in double quotes with a semicolon but to no avail.

awk...
52,753
Posted By Ghetz
The input files were originally Excel files which...
The input files were originally Excel files which were saved as tab delimited text files.

I think that may be the source of the problem.

Ghetz
52,753
Posted By Ghetz
Hi danmero I applied your code : awk...
Hi danmero

I applied your code :
awk 'NR==FNR{a[$1FS$2]=$0;next}a[tolower($1FS$2)]{print a[tolower($1FS$2)],"->",$0}' file1 file2

to the following input files and there's no output even though...
52,753
Posted By Ghetz
This is my code: #/!bin/bash ...
This is my code:


#/!bin/bash

NR==FNR{a[$1FS$2]=$0;next}a[tolower($1FS$2)]{print a[tolower($1FS$2)],"->",$0}' file1 file2 >file3

I previously tried it in Cygwin, which gave an output on a...
52,753
Posted By Ghetz
Many thanks danmero. It works perfectly. ...
Many thanks danmero.

It works perfectly.

---------- Post updated 09-30-09 at 02:27 AM ---------- Previous update was 09-29-09 at 01:33 PM ----------

My final request danmero:

I tried to...
52,753
Posted By Ghetz
Thanks danmero, but my request is slightly...
Thanks danmero, but my request is slightly different.

I want to compare file1 and file2 based on their first 2 columns (case insensitive). If the 2 columns match then print their lines to file3 as...
52,753
Posted By Ghetz
vidyadhar85, can you please extend your code to...
vidyadhar85, can you please extend your code to print the entire lines containing the matching columns to a new file (file3) separated by "->"?

for example using above:

file1:
homer simpson...
3,376
Posted By Ghetz
Many thanks vgersh99, It works!
Many thanks vgersh99,

It works!
3,376
Posted By Ghetz
Thanks vgersh99 for your reply. Your code...
Thanks vgersh99 for your reply.

Your code works but it throws up the following error:



Any suggestion to fixing this?

Thanks again for help so far.
3,376
Posted By Ghetz
Directing awk output to a folder
Dear All

I have a simple bash script that creates a folder ( I called it TEMP) in the current directory.

The question is: how do I direct the output of my awk script into folder TEMP?
...
6,137
Posted By Ghetz
siba Thanks, your code works just like...
siba
Thanks, your code works just like danmero's earlier solution.

danmero
Much appreciation, you have answered my last question.
6,137
Posted By Ghetz
gch Thanks for you "cut" suggestion. ...
gch
Thanks for you "cut" suggestion.

danmero

Seems like, but not.

The sample file contains "layers" for a visualization program.

For example:

0.000000 1.txt
66576.867188 4232.454102...
6,137
Posted By Ghetz
Thanks danmero, your last solution is even...
Thanks danmero, your last solution is even better.

Sorry I didn't make myself clear initially.

Now one last request:

If I enter values for the 4th and 5th columns on the command line, how...
6,137
Posted By Ghetz
cambridge and danmero cambridge's code...
cambridge and danmero

cambridge's code generates the following error message:
awk: syntax error at source line 1
context is
{print >> $4 " >>> " <<<
awk: illegal statement at source line 1...
6,137
Posted By Ghetz
danmero, Here is a data sample: ...
danmero,

Here is a data sample:
76576.867188 6232.454102 1.944000 0.000000 1
76576.867188 6232.454102 2.549000 0.000000 2
76576.867188 6232.454102 3.517000 0.000000 3
76576.867188 6232.454102...
6,137
Posted By Ghetz
Franklin I get an error message similar to...
Franklin
I get an error message similar to danmero's with your code:



danmero

I don't need the length of the 4th field per se.
I focused on it out of fustration I guess.

I am still...
6,137
Posted By Ghetz
To Franklin52 and All, Sorry for not making...
To Franklin52 and All,

Sorry for not making myself clear in my earlier post.

I want output files like:

55.000 3.txt
76576.867188 6232.454102 2.008904 55.000000 3...
6,137
Posted By Ghetz
sort and split file by 2 cols (1 col after the other)
Dear All,

I am a newbie to shell scripting so this one is really over my head.

I have a text file with five fields as below:

76576.867188 6232.454102 2.008904 55.000000 3
76576.867188...
Showing results 1 to 22 of 22

 
All times are GMT -4. The time now is 12:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy