Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: novice_man
3,042
Posted By novice_man
SED equivalent for grep -w -f with pattern having special characters
I'm looking for SED equivalent for grep -w -f. All I want is to search a list of patterns from a file. Also If the pattern doesn't match I do not want "null returned", rather I would prefer some...
2,529
Posted By novice_man
I can see it working ... Is there a way I...
I can see it working ...

Is there a way I can publish missing cases from each of the file using the existing awk

Also do we have "SED" equivalent of "grep -f" as I need to process few millions...
2,529
Posted By novice_man
In the example input files I have mentioned we...
In the example input files I have mentioned we have "zzz" in all files, but with the given awk it is not getting printed out. Also I would need to print the values of 2nd column for the matching...
2,529
Posted By novice_man
I tried ... It doesn't seem to work ...
I tried ... It doesn't seem to work


#!/bin/csh
foreach x ( `cat input_pattern_file` )
sed -n '/${x}/p' f1 >> out
# grep -w "$x" f1
end


Thanks.
2,529
Posted By novice_man
Searching across multiple files if pattern is available in all files searched
I have a list of pattern in a file, I want each of these pattern been searched from 4 files. I was wondering this can be done in SED / AWK.

say my 4 files to be searched are

> cat f1
...
8,301
Posted By novice_man
awk 'NR==FNR{n[$1];next}!(FNR in n)'...
awk 'NR==FNR{n[$1];next}!(FNR in n)' lines_nos_to_be_deleted_in_a_file input_file > output

worked, Thanks.
8,301
Posted By novice_man
Delete lines based on line number
I have a file with ~200K lines, I need to delete 4K lines in it. There is no range.
I do have the line numbers of the lines which I want to be deleted.

I did tried using

> cat del.lines...
1,172
Posted By novice_man
That did the trick !!! Thanks Pravin /...
That did the trick !!!

Thanks Pravin / Kurumi / otheus.
1,172
Posted By novice_man
Hi Kurumi, Many Thanks, it is cool. I have...
Hi Kurumi,

Many Thanks, it is cool. I have not heard of "ruby" in the past. I have a small change in the need.

For columns with negative numbers, I want the biggest negative number. For...
1,172
Posted By novice_man
numbers comparison in fields of a file and print least value of them
Hi ,

I'm trying to compare fields in the file, I want compare the numbers in each column and get the least value of it.

> cat input_file
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 ...
1,753
Posted By novice_man
I'm such a dud, I missed it earlier. Yeah...
I'm such a dud, I missed it earlier.

Yeah it works,

Thanks a lot
1,753
Posted By novice_man
Hi Scrutinizer, The script still prints...
Hi Scrutinizer,

The script still prints common lines only, Can you please comment.


$ cat f1
a b 1
c d 2
e f 3

$ cat f2
e f 3
a b 1
g h 1

$ source awk.csh
a b 1 a b 1
e f 3 ...
1,753
Posted By novice_man
Awesome, It worked as a charm. (1) Also Is...
Awesome, It worked as a charm.

(1) Also Is it possible to print the non-matching cases from both files

(2) Interest of learning, If possible can you explain the command used.

Thanks.
1,753
Posted By novice_man
compare 2 files based on columns
Hi Experts,

Is there a way to compare 2 files by columns and print matching cases.
I have 2 files as below, I want cases where col1 and col2 in f1 matches col1 and col2 in f2 to be printed...
2,139
Posted By novice_man
merging of 2 consecutive lines in a file for a specific pattern
Hi ,

I'm looking for a way to merge two lines only for a given pattern / condition.

Input :


abcd/dad + -49.201 2.09 -49.5 34 ewrew rewtre *...
1,933
Posted By novice_man
Hi Rohon, Thanks for all your prompt...
Hi Rohon,

Thanks for all your prompt replies, I managed to get it working using,

My intent was to get "abd/asd" from "abd/asd/a[5]" and use it in script later.

> set a= `rev bp | cut...
1,933
Posted By novice_man
No it doesn't work here. $ set var="a[5]" $...
No it doesn't work here.
$ set var="a[5]"
$ echo $var
echo: No match.

Thanks.
1,933
Posted By novice_man
I did try it, still it has an issue ... (...
I did try it, still it has an issue ... ( basename doesnt work in this fashion )
$ cat bp | basename
basename: missing operand
Try `basename --help' for more information.

Just FYI ( to keep it...
1,933
Posted By novice_man
Here is what I see here, $ basename `cat bp`...
Here is what I see here,

$ basename `cat bp`
q[3]

$ a="$1"
a=: Command not found.

$ echo $a

Note : I did try setting set a="$1", as well

Thanks.
1,933
Posted By novice_man
Hi Rohon, Yes it get a[5], the problem i...
Hi Rohon,

Yes it get a[5], the problem i have is I'm unable to store into a Unix variable.
Can you please let me know, how can I store the output as a unix variable.

Thanks.
1,933
Posted By novice_man
Hi Rohon, It doesn't work here. $cat...
Hi Rohon,

It doesn't work here.

$cat bp
asd/dad/a[5]

$ set a=`awk -F"\/" '{print $NF}' bp`
awk: warning: escape sequence `\/' treated as plain `/'

$ echo $a
echo: No match.

Thanks.
1,933
Posted By novice_man
Hi Rohon, I intend to use the stored...
Hi Rohon,

I intend to use the stored variable in my shell script later ( $a )

set a=`awk -F "/" '{print $NF}' bp | awk '{print $1}'`



Thanks.
1,933
Posted By novice_man
assign var with set=a[5] not working
Hi Experts,

I'm having issue in assigning var with special character [], please see below for complete details.

$ echo $SHELL
/bin/csh

$ cat bp
abd/asd/a[5]

$ awk -F "/" '{print...
Showing results 1 to 23 of 23

 

Featured Tech Videos

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