The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Presented By: The user-driven evolution of tbb::pipeline iBot Software Releases - RSS News 0 08-07-2008 01:20 PM
How to write comments in Korn shell script sasaliasim Shell Programming and Scripting 1 04-24-2008 04:23 PM
python-pipeline 0.1 (Default branch) iBot Software Releases - RSS News 0 01-03-2008 05:20 PM
Unix Pipeline help netmaster UNIX for Dummies Questions & Answers 2 11-15-2005 10:42 AM
C program help please! input from pipeline kinggizmo High Level Programming 2 04-28-2002 02:33 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-18-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,884
Comments within a shell pipeline

I've got a very ugly pipeline for analyzing web server logs (but nevermind the application; I've come across this in other scripts as well). I want to nicely comment the steps in the pipeline, but I can't seem to do it.

I know, for instance that in csh/sh/bash, a # begins a comment, and any subsequent \ or | will be ignored. I've tried playing with : but to little avail (I'm using bash v3.1).

Here's a sample of the pipeline:

Code:
cat /var/log/access_fille \
| grep '".*" 4[0-9][0-9] ' \
| grep -v ' /favicon.ico ' \
| grep -o '".*" 4[0-9][0-9] ' \
| sort | uniq -c | sort -n | tail | tee $tmpfile
Can you see why I might want to comment these steps?
  #2 (permalink)  
Old 09-18-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Code:
grep '".*" 4[0-9][0-9] ' /var/log/access_file | ## COMMENT
 grep -v ' /favicon.ico ' | ## COMMENT
  grep -o '".*" 4[0-9][0-9] ' | ## COMMENT
   sort | ## COMMENT
    uniq -c | ## COMMENT
     sort -n | ## COMMENT
      tail | ## COMMENT
       tee "$tmpfile"
  #3 (permalink)  
Old 09-18-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,884
Thanks!!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0