Search Results

Search: Posts Made By: zoo591
7,122
Posted By zoo591
globbing, $# is too high after wildcard expansion in bash script
How can I pass in an argument such as "*.k" to a bash script
without having to double-quote *.k and not having *.k
`glob` to match all files in the pattern?

I tried using noglob in my script...
4,573
Posted By zoo591
Nicely done. You are numero uno AWK!:b:
Nicely done. You are numero uno AWK!:b:
4,573
Posted By zoo591
gawk script
Hey guys need your help with an gawk script... here's what I have so far

gawk '^d/ {printf "%-20s %-10s %-10s %-10s %-4s%2s %5s\n",$9,$1,$3,$4,$6,$7,$8}' ls.kbr

The file ls.kbr is a capture of ...
6,535
Posted By zoo591
I am not sure the reason for the syntax error...
I am not sure the reason for the syntax error even though
shopt -s extglob had been used. In the end I used this command
as an alternative to 'cp' and it seems to do the trick.

Thanks Reborg...
6,535
Posted By zoo591
I did activate this. Do I need to activate it...
I did activate this. Do I need to activate it within the script as well?
6,535
Posted By zoo591
Pattern matching in BASH
i have 255 files in a directory named 000po.k thru 255po.k
and I want to copy all files except 3: exclude 000po.k, 166po.k,168po.k

I know the long way around it copying these files, but am...
10,205
Posted By zoo591
Thank you vgersh99. That was exactly the...
Thank you vgersh99. That was exactly the problem.
The script now works as intended.
10,205
Posted By zoo591
awk string manipulation
Here is my awk code in a shell script:

localRecDir=/somedirectory/
#
awk -v LRD="$localRecDir" '{out = sprintf ("%s0000000%s"),LRD,substr($3,4) ; print > out; close(out)}' *.log

Here is the...
2,149
Posted By zoo591
Your code worked perfectly! Now I will put...
Your code worked perfectly!
Now I will put forth the time to try and understand what is happening.

Thanks again.
2,149
Posted By zoo591
I get this error: awk: Syntax error at...
I get this error:

awk: Syntax error
at line 1 of program << { print $1 $2 $3 $4 ... >>
context is
{ print $1 $2 $3 $4 $5 $6 > >>> $3. <<< "txt" }
awk: illegal statement
at line...
2,149
Posted By zoo591
awk newbie
I would like to parse a file and use each record to create a unique file
where the name of the file created is taken from the 3rd field.

Example: here are 3 records.

000007 0110 ...
12,146
Posted By zoo591
I tried it but still no go. vgersh99, I...
I tried it but still no go.

vgersh99, I don't know if this helps but Reborg's script outputs:

s.154pl.k:240: spool (6) "211I/C" to key

where as your script chops this into:

C" to key...
12,146
Posted By zoo591
Reborg, this worked great! I appended a cut...
Reborg, this worked great! I appended a cut command to your script
I got exactly what I was looking for:

ACCEPTED ANSWER:
The final version of the script:
grep -n "$1" $SCCSPATH/*/s.*.k | sed...
12,146
Posted By zoo591
So far you are the closest to resolving my issue,...
So far you are the closest to resolving my issue, but that redirection didn't
help. Output of your script shown below:

s.195pr.k:95:* 1.32 121197 Bug fix of gross earnings...
12,146
Posted By zoo591
I tried your script with the fix. It is close to...
I tried your script with the fix. It is close to what I want, but it is not displaying the basename of the file. Output of your script shown below:

:1743:* fix 121197 <-- I would like the...
12,146
Posted By zoo591
reborg, sorry but this wasn't what I had in mind....
reborg, sorry but this wasn't what I had in mind.

Output from your script below:

:1:h21108
:1:h21174
:1:h52119
:1:h30211
12,146
Posted By zoo591
vgersh99, can you elaborate on your post please. ...
vgersh99, can you elaborate on your post please.

I tried changing my script to:

grep -n "$1" $SCCSPATH/*/s.*.k | nawk -F/ '{print $NF}'

as I thought that is where you were leading me. It...
12,146
Posted By zoo591
RishiPahuja: while your answer does provide a...
RishiPahuja: while your answer does provide a filename it is not quite what I am
looking for as it prints the names of file even when they do not match the
search pattern. Output of your script...
12,146
Posted By zoo591
I tried your script RishiPahuja, but it had a...
I tried your script RishiPahuja, but it had a problem with the basename
due to the -l option on ls as that supplied file attributes to the basename.

After removing the -l option your script did...
12,146
Posted By zoo591
need grep to output basename and line#
I have a script that sorta works the way I want but I would rather
just get the base name and line number from the grep output.

My current script is this one liner:

grep -n "$1"...
Showing results 1 to 20 of 20

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