LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-15-2012, 05:39 AM   #1
hayko
LQ Newbie
 
Registered: Sep 2012
Posts: 5

Rep: Reputation: Disabled
Question Awk script question


Hello,
Please help

how can i compare every next and previous lines NR NR+1 in file with bash script or awk.
 
Old 09-15-2012, 09:48 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
hayko, this is third time out of three posts that you've hijacked another thread. For a new subject please start a new thread. To do that go to the forum summary page for a forum appropriate to your question, and click the 'New Thread' button near the top of the page.
--- rod.
 
Old 09-20-2012, 10:04 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Looks like the mods have done it for you.
 
Old 09-20-2012, 10:23 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
And please show what you have tried and where you are stuck?
 
Old 09-23-2012, 04:28 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
How about even just clearly explaining what you want to do? The question as it stands is really too vague to answer. Generalized one-sentence questions like this will usually get you equally generalized replies in return, if even that much.

What exactly needs to be compared, in what way? What does the input look like, and what should the output look like? Try posting some example text, and the code for any previous attempts you've made (and don't forget to use ***[code][/code] tags*** when you do).


Please read How To Ask Questions The Smart Way, and then try supplying us with more details.
 
Old 09-23-2012, 04:44 AM   #6
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by hayko View Post
Hello,
Please help

how can i compare every next and previous lines NR NR+1 in file with bash script or awk.
since no one wants to reply to you in this forum, let's start with something...


Code:
whatever ... | awk -v counter=1 ' {  here you check each line NR+1 whether it is same as NR using a counter.  }  '
http://www.shellunix.com/awk.html
check if command
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash/awk script question chogall Programming 7 12-23-2010 01:54 AM
[SOLVED] BASH Script, 'awk' and 'if' question. lupusarcanus Linux - Newbie 7 03-14-2010 11:07 AM
Shell Script / awk / perl Question cmontr Programming 11 06-25-2008 01:00 PM
simple awk script question adam_blackice Programming 9 09-03-2007 02:23 PM
Bash script question (grep and awk) hamish Linux - Software 6 04-06-2005 03:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration