Sponsored Content
Full Discussion: Seeking help with search
Top Forums Shell Programming and Scripting Seeking help with search Post 302923312 by bbbngowc on Friday 31st of October 2014 10:02:27 PM
Old 10-31-2014
Quote:
Originally Posted by Corona688
awk somewhat resembles grep on steroids, it scans lines but is a proper language with variables and columns and things.
Code:
awk '($3 == V) || ($4 == V) { print $3,$4 }' V=1234567890 inputfile

I must be doing it wrong. It's not returning a value. A simple grep echos the 1234567890 value so I know it's in there, but the awk statement is not finding it.

$3 and $4 are representations of Fields 3 and 4 correct?

---------- Post updated at 10:02 PM ---------- Previous update was at 09:49 PM ----------

This appeared to have worked for what I want

Code:
grep -B 1 -A 1 "1234567890" *.txt

I didn't know grep had a B (before) and A (after) option that allows you to print the line before and the line after the search string.
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

seeking a doc on lvm etc...

Hi. I wanted to increase my knowledge base with unix. can you help me find a like that talks about luns, physical volumes, volume groups, logical volumes then mountpoints? i would appreciate it thanks Jigar (1 Reply)
Discussion started by: jigarlakhani
1 Replies

2. UNIX for Dummies Questions & Answers

Control Panel seeking.

Hi, guys. My friends and I used to rent space from our ISP, and they applied Cpanel to help us to config. Recently we just upgrade to the dedicated server plan, and there is nothing but only the os has been installed. Since Cpanel is the commercial software, we cannot afford it, we need to find a... (2 Replies)
Discussion started by: HOUSCOUS
2 Replies

3. Shell Programming and Scripting

awk: seeking to bytes

can I seek to a particular byte in a file and replace it using awk? if so, how? (8 Replies)
Discussion started by: karyn1617
8 Replies

4. UNIX for Dummies Questions & Answers

Seeking UNIX documentation

Hi, I am looking for documentation (PDF, DOC, books, web ...) about UNIX scripts. What could you advice me ? Thanks. (3 Replies)
Discussion started by: Filippo
3 Replies

5. UNIX for Dummies Questions & Answers

Seeking help...Urgent!!! Please help me...

Can any1 please help me answer a couple of this question? 1) What is the process management of UNIX? (single task, multitasks, etc...) 2) What is the process management of Linux? (single task, multitasks, etc...) 3) What is the type of process of UNIX? (process, thread, etc...) 4)... (1 Reply)
Discussion started by: blind02002
1 Replies

6. Shell Programming and Scripting

seeking help with shell script

I am trying to update a script which I had created to monitor tablespace usage. Originally the sql spooled out to a text file anything with more than 75% used. I have been asked to change this. Now the sql must spool out all tablespaces. The script I have to write should scan the file for... (4 Replies)
Discussion started by: Niadh
4 Replies

7. Programming

Seeking Some libs for AIX 5.3

hello everybody! I m compiling some program with the g++ on AIX 5.3 and it needs some library that i didn't find them i am new with the AIX here is the compilation error : g++ -Daix -fpic -o printps -lxercesc1_1 -L/oracle/OraHome/lib32/ -L/epost2/blitz/lib -lhmltods -lhmltops -lgeneric... (0 Replies)
Discussion started by: eternalflame
0 Replies

8. Shell Programming and Scripting

[grep] seeking more than one word

Hello everybody, How can I do seek several words with grep command ? I didn't find how to do that in the man for I'm French. Then I tried man bash | grep -in control flow But flow is interpreted as an input file Then I tried man bash | grep -in "control" -a "flow" but doesn't seem to work... (4 Replies)
Discussion started by: Oddant
4 Replies

9. Shell Programming and Scripting

Seeking Alternative for diff in hp

Hi , I have to use HP-unix OS to get difference between 2 files.while i tried a piece of code in other OS(linux/unix) as below, it worked fine & the output is desired one. diff --suppress-common-lines -y file_1 file_2 >d.txt The same doesn't works in HP -unix. Any help shall be... (6 Replies)
Discussion started by: vinil
6 Replies
scroll(3NCURSES)														  scroll(3NCURSES)

NAME
scroll, scrl, wscrl - scroll a curses window SYNOPSIS
#include <curses.h> int scroll(WINDOW *win); int scrl(int n); int wscrl(WINDOW *win, int n); DESCRIPTION
The scroll routine scrolls the window up one line. This involves moving the lines in the window data structure. As an optimization, if the scrolling region of the window is the entire screen, the physical screen may be scrolled at the same time. For positive n, the scrl and wscrl routines scroll the window up n lines (line i+n becomes i); otherwise scroll the window down n lines. This involves moving the lines in the window character image structure. The current cursor position is not changed. For these functions to work, scrolling must be enabled via scrollok. RETURN VALUE
These routines return ERR upon failure, and OK (SVr4 only specifies "an integer value other than ERR") upon successful completion. X/Open defines no error conditions. This implementation returns an error if the window pointer is null, or if scrolling is not enabled in the window, e.g., with scrollok. NOTES
Note that scrl and scroll may be macros. The SVr4 documentation says that the optimization of physically scrolling immediately if the scroll region is the entire screen "is" per- formed, not "may be" performed. This implementation deliberately does not guarantee that this will occur, to leave open the possibility of smarter optimization of multiple scroll actions on the next update. Neither the SVr4 nor the XSI documentation specify whether the current attribute or current color-pair of blanks generated by the scroll function is zeroed. Under this implementation it is. PORTABILITY
The XSI Curses standard, Issue 4 describes these functions. SEE ALSO
ncurses(3NCURSES), outopts(3NCURSES) scroll(3NCURSES)
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy