Search Results

Search: Posts Made By: SaltyDog
14,802
Posted By Scrutinizer
On Solaris use /usr/xpg4/bin/awk or nawk......
On Solaris use /usr/xpg4/bin/awk or nawk... Otherwise try this:

awk '$2=="Policy"{p=$3}$0~s{print p}' s=CS95869005 infile

or for example:

awk '$2=="Policy"{p=$3}$0~s{print p}' s="No BC...
14,802
Posted By ygemici
# cat data .............. .... ....... ...
# cat data
..............
....
.......
................
....................
CS02010002 Policy "9999998599"
CS13000008 Tax processing was done for 17/03/2012.
..............
....
..........
14,802
Posted By drl
Hi. I'm still not confident that I...
Hi.

I'm still not confident that I understand your question, so perhaps these meta-answers may help.

There was a suggested solution from balajesuri in perl that you may have missed. I don't...
14,802
Posted By drl
Hi. Providing representative samples of your...
Hi.

Providing representative samples of your data and expected output invites fast and accurate responses. Otherwise the answers either will use no data, or will use individual and / or eccentric...
14,802
Posted By ygemici
i m not clear about your inputfile but maybe try...
i m not clear about your inputfile but maybe try this
# awk 'NR>9005-10&&NR<=9005&&$0~/policy/{x=$0}END{print x}' infile
14,802
Posted By balajesuri
Perl, ok? You may have to install...
Perl, ok? You may have to install "File::ReadBackwards" module.

#!/usr/bin/perl
use File::ReadBackwards;

$x = File::ReadBackwards -> new('inputfile.txt');

while ( defined($line =...
14,802
Posted By birei
Hi SaltyDog, I don't understand your...
Hi SaltyDog,

I don't understand your explanation, but to search for a word backwards, use:

$ tac infile | sed -n '/word/ { p ; q }'
Showing results 1 to 7 of 7

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