Search Results

Search: Posts Made By: TheCrunge
13,158
Posted By TheCrunge
awk print fields to multiple files?
I am trying to print the output of a command to two separate files. Is it possible to use awk to print $1 to one file and $2 to another file?

Thanks in advance!
4,981
Posted By TheCrunge
Thanks you, that works well.
Thanks you, that works well.
4,981
Posted By TheCrunge
Passing variable to perl
I need a non-perl (bash) way to strip the path from a list of "find" results. Below is the perl version which I could use, if I could figure out how to call the script with a variable (like in sh, $1...
19,077
Posted By TheCrunge
Thanks for that. I use the search feature, and...
Thanks for that. I use the search feature, and didn't find that post.

Thanks again! :D
19,077
Posted By TheCrunge
Add a list of numbers
I need to add a list of numbers contained in a file. For example, the file would look like this:

10
290
342
5409


I need to get a total sum of all the numbers in the list. Any ideas?
...
6,180
Posted By TheCrunge
Error check
How would I go about an error check within a script. For example, if I have a script that I know might contain an error with a certain command, is there a way to give an alternate command if the...
2,880
Posted By TheCrunge
That's does it, thanks!!! (You guys rock!)
That's does it, thanks!!!


(You guys rock!)
2,880
Posted By TheCrunge
Output of command to 2 separate file?
How would I echo the same results to two files? One is a running log, and the other is a cache, or sort.

echo "Hello World" >> /Logs/File1 & /tmp/file2

I would just copy it from one place to...
2,071
Posted By TheCrunge
Setting values in an array? Easy one
I need to do something like this:

KEYS=[key1,key2,key3,key4]

for key in $KEYS
do
echo $key
done


The KEYS are static values in my script, I'm just having trouble with setting them as...
5,803
Posted By TheCrunge
Truncated with a pipe?
OK, I'm stumped.

I have a shell script that reads a list, and for every item in the list performs a lookup in our Active Directory. Now, it seems that when I pipe the results into grep, the...
2,326
Posted By TheCrunge
Processing a text file
A file contains one name per line, such as:

john doe
jack bruce
nancy smith
sam riley

When I 'cat' the file, the white space is treated as a new line. For example

list=`(cat...
4,582
Posted By TheCrunge
Changing capitalization
How would I go about taking a string, such as a name (first last) and changing the capitalization of the first letter of each name (First Last)?

A script that I am using outputs a list of names in...
12,144
Posted By TheCrunge
Add text to file at a certain line
I am trying to add a line of text just before the last line in a file.

For example, if the last line of a file is "exit 0", I need to add a line of text just before that.

Any ideas how I might...
2,497
Posted By TheCrunge
Yep, the grep (or grep -v) doesn't work, not sure...
Yep, the grep (or grep -v) doesn't work, not sure why.

As far as being on their own line, they are.

The only problem is however, that I was trying to put the whole statment into a variable,...
2,497
Posted By TheCrunge
OK, the second one works, except I can't seem to...
OK, the second one works, except I can't seem to getifaddr on lo0, I need to be able to list all interfaces, except lo0

Oh, and how can I get each interface listed on it's own line?

Thanks!
2,497
Posted By TheCrunge
Do I need an array here?
I am still really foggy on how to make an array work for me....

I need to take the results of one command, and split it, then do another command on each result. For example:



# list all...
3,165
Posted By TheCrunge
Yeah, I don't think this is going to work. I'm os...
Yeah, I don't think this is going to work. I'm os OS X and I don't have the korn shell on the client computers.

I'll figure out a way. I think all I need is the unmount command, because if the...
3,165
Posted By TheCrunge
That doesn't seem to work. It's doing the ...
That doesn't seem to work. It's doing the "else", even though Backups_Admin is in /Volumes/
3,165
Posted By TheCrunge
Operator question
I need to find out if a variable contains a certain text string, then do something about it.

Here is what I mean, but I don't know how to get a "contains" operator



# We have volumes called:...
1,814
Posted By TheCrunge
Hmmm... this project is actually a "homework"...
Hmmm... this project is actually a "homework" assignment of sorts already.

Anyway, you've been helpful and I appreciate it.
1,814
Posted By TheCrunge
I'm going to take that as a compliment ;) ...
I'm going to take that as a compliment ;)


Anyway, thanks, it your info serves my purpose.

Any idea if I can "sort" this my month?

Maybe you have some time to help "pretty up" my code?
1,814
Posted By TheCrunge
Question about formatting results
OK, I have a command that is getting a result, that I am trying to format using awk.

I think it's pretty ugly, and there is probably a better way to do it, but this is sorta working for me....
1,738
Posted By TheCrunge
Array question
When setting a variable, how would I go about making each result a new line?

A very simple example would be:

theFolders=`(ls -l /)`

echo $theFolders
This gives me all the folders as one...
14,525
Posted By TheCrunge
Easy question about awk gsub
How does one escape the left bracket in awk?

For example:
| awk 'gsub ("[", ""); {print}'


Gives this:

awk: nonterminated character class [
source line number 1
context is
...
3,287
Posted By TheCrunge
OK, here's the deal (my head is starting to hurt...
OK, here's the deal (my head is starting to hurt here):confused:

I need to get the number of Jobs that are printed on each printer, per date, by user.

What you did earlier helped get the...
Showing results 1 to 25 of 28

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