Sponsored Content
Top Forums Shell Programming and Scripting Can anyone guide me with the BASH scripting Post 302410711 by vgersh99 on Tuesday 6th of April 2010 03:45:09 PM
Old 04-06-2010
Quote:
Originally Posted by durden_tyler
If you are talking about the awk script, then try to print a tab-delimited output. I believe a single comma prints a single space in awk.
A comma a 'print' statement prints a value of the of the 'OFS' variable - by default it's a single space.
Quote:
Originally Posted by durden_tyler
A tab-delimited text file should open up as an Excel worksheet with column-splitted data without requiring you to do anything else.

tyler_durden


---------- Post updated at 03:45 PM ---------- Previous update was at 03:42 PM ----------

Quote:
Originally Posted by shyork2001
I tried the this , and still not working

zgrep -a --text "aaaa" * | awk -F"[ .,]" '{sub(".*:","",$6); sub(",.*","",$7); print $1,$6,$7,$10}' > /home/tss/myfile
try this if you need a csv:
Code:
zgrep -a --text "aaaa" * | awk -F"[ .,]" '{sub(".*:","",$6);  sub(",.*","",$7); print $1,$6,$7,$10}' OFS=',' > /home/tss/myfile

 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

comprehensive guide for shell scripting programming

Dear all Any recommendation for this, web-site or publisher? (3 Replies)
Discussion started by: trynew
3 Replies

2. UNIX for Dummies Questions & Answers

Should I do a bash scripting course?!

Hello, I'm confused (oh, yes). I'm running Linux at work. When I type 'echo $SHELL' I am told that I'm running tcsh. In /bin I note that both tcsh and bash are listed. Question 1: Can I swap to run bash rather than tcsh and, if so, how will this affect my system? Is there any advantage to... (6 Replies)
Discussion started by: macpete
6 Replies

3. Shell Programming and Scripting

bash scripting help

hi all i'm trying to get a script working upon connection with pppd According to docu this happens ina clean environment with a couple of variables set, namely $1,$2,... To be able to execute the statements i included a path statement but i think i'm running into trouble with the variables -... (6 Replies)
Discussion started by: jimjones
6 Replies

4. Shell Programming and Scripting

bash scripting

Hello everyone!!!! I am new to this forum ...I have a problem. And I thought that you are expert :) so you can help me with that... I have a text file with maaany lines. Every line begins with something like that: <http aksjfskcuhrf kushkfsnus> <http sxnfrksehfsd gsdg r> I don't know if every... (16 Replies)
Discussion started by: mary_elen
16 Replies

5. Shell Programming and Scripting

bash scripting

same script: 1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit. 2- also i want to add # in front of the following lines in... (0 Replies)
Discussion started by: lamoul
0 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy