Search Results

Search: Posts Made By: cs03dmj
13,173
Posted By cs03dmj
Works a treat! Thanks radoulov... :b:
Works a treat! Thanks radoulov... :b:
13,173
Posted By cs03dmj
SunOS & Korn or Bash Shell An example. The...
SunOS & Korn or Bash Shell

An example. The following files contain the word "pet":

archive_file.csv
file_2.csv
file_3.csv


Here they are in the directory structure:

/directory_1/...
13,173
Posted By cs03dmj
Combining find, grep and possibly ls?!
Hi - can someone please help me combine find, grep and possibly ls into something workable:

i.e. How can I list all the files that contain the word "pet" in all directories under the current...
3,387
Posted By cs03dmj
Good point, kshji, but we use multiple...
Good point, kshji, but we use multiple "extensions" and hence require the filename to be stripped at the first "."

For your example, a slight alteration would suffice: :)

if [ `for file in $@;...
3,387
Posted By cs03dmj
Thanks both. Posix - your suggestion...
Thanks both.

Posix - your suggestion prompted the following which is much easier to follow than my previous attempt(s) - thanks!

if [ `for file in $@; do
echo ${file} | sed...
5,650
Posted By cs03dmj
How to (n)awk lines of CSV with certain number of fields?
I have a CSV file with a variable number of fields per record. How do I print lines of a certain number of fields only? Several permutations of the following (including the use of escape characters)...
3,387
Posted By cs03dmj
How to check that passed parameters all have the same extension?
$ ls
monkey.txt
banana.csv
tree.txt
$ myscript monkey.txt tree.txt
All extensions ARE alike.
$ myscript *txt
All extensions ARE alike.
$ myscript monkey.txt banana.csv
All extensions are NOT...
2,887
Posted By cs03dmj
Thanks for the inspiration, vgersh99! Revised...
Thanks for the inspiration, vgersh99! Revised code:

# FindR - Find(e)r - Find( )R(ecords)
# Finds certain records within decoded files given one or more search patterns...
# v3.0 - 20100317 -...
2,887
Posted By cs03dmj
Thanks to you all for this; I have subsequently...
Thanks to you all for this; I have subsequently learnt a lot and expanded my final script (https://www.unix.com/302404854-post9.html) (should it help anyone in future), which allows multiple searches...
2,887
Posted By cs03dmj
Thanks to you both, but Franklin52 - that is...
Thanks to you both, but Franklin52 - that is exactly what I was after, save for needing to use nawk instead of awk (presumably due to the size of my input file). Would you be so kind as to walk me...
2,887
Posted By cs03dmj
Capturing multi-line records containing known value?
Some records in a file look like this, with any number of lines between start and end flags:

/Start
Some stuff
Banana 1
Some more stuff
End/

/Start
Some stuff
End/

/Start
Some stuff...
2,878
Posted By cs03dmj
...not at all; perhaps I just haven't been clear...
...not at all; perhaps I just haven't been clear enough. Imagine a user knows the exact field names, but not the field numbers, and there are hundreds of columns. Rather than having to know that...
2,878
Posted By cs03dmj
Thanks, but I was wondering if the variables can...
Thanks, but I was wondering if the variables can be set programatically from within a single (n)awk script, e.g.
2,878
Posted By cs03dmj
Extract CSV records using NAWK?
Example CSV:

$ cat myfile
HDR
COL_A,COL_B,COL_C
X,Y,Z
Z,Y,X
...
X,W,Z

In this example, I know that column names are on the second line. I also know that I would like to print lines where...
3,935
Posted By cs03dmj
Nope, definitely something wrong with tr my logic...
Nope, definitely something wrong with tr my logic (see post below)! Regardless, I have a workable solution (albeit with an error that can be redirected away from view) using a different tr...
3,935
Posted By cs03dmj
Thanks Doc, unfortunately my issue is not with...
Thanks Doc, unfortunately my issue is not with the sed command itself (yours or mine would suffice), but that tr does not seem to pipe its output as expected. Unless anyone has any fancy ideas, I'm...
3,935
Posted By cs03dmj
Issue piping TR to SED
Trying to get oracle column headings to CSV format without success.

{myprompt}$ sqlplus -S user/pass <<EOF | tr '\n' ','
SET echo off heading off feedback off pages 0
SELECT column_name
FROM...
4,991
Posted By cs03dmj
Thanks Dennis - I've posted the solution I worked...
Thanks Dennis - I've posted the solution I worked out above, but yours works too!
4,991
Posted By cs03dmj
[SOLVED] Possible to combine inline redirection with pipes? [YES!]
Would like to use a here document (http://en.wikipedia.org/wiki/Here_document) in a shell script with sqlplus and pipe the output to sed (etc.) before ultimately redirecting the lot to a file, e.g:
...
7,534
Posted By cs03dmj
...superb! How my hour of Googling didn't find a...
...superb! How my hour of Googling didn't find a similar problem, I'll never know!
7,534
Posted By cs03dmj
SED: Print range, exclude regular expressions.
Ok, so I get that:

sed -n '/START/,/END/p' file

...will print every line from START to END inclusive, but I don't want to see START or END. Apart from the obious:

sed -n '/START/,/END/p'...
3,659
Posted By cs03dmj
Great pointers - the first character in brackets...
Great pointers - the first character in brackets can actually vary i.e. (I)/(W)/(D), but I've dusted off my sed/awk reference and will let you know how I get on! :D
3,659
Posted By cs03dmj
EDIT: Erroneous ")" - seems to work with it...
EDIT: Erroneous ")" - seems to work with it removed!

Thanks Jim - figured awk might be my best bet, but your code is giving me some grief and I'm not sure why...

awk: cmd. line:4: ...
3,659
Posted By cs03dmj
Strip timestamps from logs using sed?
Hullo. I have a log file:

(I) 02/03/2009 12:31:01 [12345] : Service Started
(I) 02/03/2009 12:31:02 [12345] : XML:
<xml>
<stuff>
...
</xml>
(I) 02/03/2009 12:31:02 [12345] : Service...
93,593
Posted By cs03dmj
ssh -q -o "BatchMode=yes" user@host "echo 2>&1"...
ssh -q -o "BatchMode=yes" user@host "echo 2>&1" && echo "OK" || echo "NOK"

...will solve your problem, by running quietly and in batch mode (no user present to enter a password). See man...
Showing results 1 to 25 of 33

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