Search Results

Search: Posts Made By: jaysean
3,986
Posted By jaysean
thanks. i know i can use -k5,5nr but then it will...
thanks. i know i can use -k5,5nr but then it will not consider the change in ids in the column 1.
3,986
Posted By jaysean
sorting on one column
Hello all,

Is there a way to sort only one column while keeping everything else intact. Take for example this situation: (all columns are space separated)

11 AA asdf 1 -0.5 xx
11 AA axdf 1...
1,151
Posted By jaysean
woo hoo!!! such a quick reply and works too :)
woo hoo!!! such a quick reply and works too :)
1,151
Posted By jaysean
Finding the highest value(in negative)
Hi all,

I have a simple problem. I have given an example of the problem below.

There are 4 space-delimited columns.



2655 96 IA -0.8179
2655 96 IA -0.9144
2655 ...
2,358
Posted By jaysean
Common lines from files
Hello guys,

I need a script to get the common lines from two files with a criteria that if the first two columns match then I keep the maximum value of the 5th column.(tab separated columns) ....
2,364
Posted By jaysean
agama's code has some problems, idea is right ...
agama's code has some problems, idea is right
awk -F'\t' '{if ($6 > a[$1"\t"$4"\t"$5]){a[$1"\t"$4"\t"$5]=$6;b[$1"\t"$4"\t"$5]=$0 }}END{for (i in a) print b[i]}' $FILE
2,364
Posted By jaysean
awk comparison
Hello all,

Probably a very simple question, I am stuck with a small part of a code:

I am trying to do a comparison to get the maximum value of column 6 if columns 1, 4 and 5 of two or more rows...
14,896
Posted By jaysean
thanks guys for your help
thanks guys for your help
14,896
Posted By jaysean
Please see this: There are 4 tab-delimited...
Please see this:
There are 4 tab-delimited columns. 3rd column may have spaces in the name.

2655 96 IA 0.8179
2655 96 eugene 0.8144
2655 96 CPU 0.4275
2655 96 RMA 0.3407
2655 96 P Proc Tran...
14,896
Posted By jaysean
Thanks Christoph, I think that your method will...
Thanks Christoph, I think that your method will work for me. But there is a slight problem, unlike the sample input that I have given in the above example, the columns are actually tab separated....
14,896
Posted By jaysean
Finding Maximum value in a column
Hello,

I am trying to get a script to work which will find the maximum value of the fourth column and assign that value to all rows where the first three columns match.

For example:

1111...
2,087
Posted By jaysean
Append instance count to each line
Hello forum,

I need help with a script for displaying the number of instances/times a particular line appears in a tab-delimited file and append that number to the end of the line.

Example...
3,008
Posted By jaysean
thanks...works for me
thanks...works for me
3,008
Posted By jaysean
Changing file extension
Hello all,

I need to change file extension for all .doc files to .txt file in multiple folders. I know the way to rename them by going to each folder and doing that, but I need something which I...
1,949
Posted By jaysean
Thanks to all. I tried the first two and both...
Thanks to all. I tried the first two and both works fine.
1,949
Posted By jaysean
Removing lines with condition
Hello guys,

I need help with a script for removing lines that does not satisfy a condition.

For example if a file has these lines:

aaaa bbbb cccc
aaaa bbbb cccc
dddd eeee ffff
gggg hhhh...
3,646
Posted By jaysean
Thanks to both you guys. Both works fine. If...
Thanks to both you guys. Both works fine. If anyone needs here it goes for a directory processing

ls DirectoryA | while read FILE; do
awk 'NR==FNR{a[$1" "$2]=$3;next;}($1" "$2 in a){if(a[$1"...
3,646
Posted By jaysean
Thanks for the reply. But the script has some...
Thanks for the reply. But the script has some problems. It does not discard the lines that are not common. The output needs to be intersection of the lines(i.e. common to both files) and also compare...
3,646
Posted By jaysean
Common lines from files
Hello guys,

I need a script to get the common lines from two files with a criteria that if the first two columns match then I keep the maximum value of the 3rd column.(tab separated columns)
...
2,766
Posted By jaysean
Thanks that works fine except that the sorting by...
Thanks that works fine except that the sorting by the number of occurrences of the words is not there. I appreciate your help.

---------- Post updated at 12:43 AM ---------- Previous update was at...
2,766
Posted By jaysean
Sample input: aaa bbb ccc aaa bbb ccc ...
Sample input:

aaa bbb ccc
aaa bbb ccc
ddd eee fff
ddd eee fff

The output from my script will be:
2 aaa
2 ddd

I want the sum of occurrence of aaa and bbb =2+2 i.e. the line count to...
2,766
Posted By jaysean
Append line count to each line
Hello forum,

I need to append the total line count to the end of each line in a file.

The file where this line count needs to be appended is generated by this script:

The script does a word...
15,179
Posted By jaysean
Thanks to both of you. However, there's one...
Thanks to both of you.

However, there's one thing to note here, unless the files end in a newline character the append will be at the end of the last line of the file and thus 2 lines will be in...
15,179
Posted By jaysean
Thanks scottn for the prompt reply. The loop...
Thanks scottn for the prompt reply.
The loop approach looks more elegant to me.
Just a small issue, what if I want the merging not to append to the directory B files, but rather put the results of...
15,179
Posted By jaysean
Merging two files with same name
Hello all,

I have limited experience in shell scripting. Here goes my question:

I have two directories that have same number of files with same file names i.e. consider 2 directories A and B....
Showing results 1 to 25 of 25

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