Search Results

Search: Posts Made By: lochraven
2,316
Posted By lochraven
Set lines of in a file to seperate vars
In a bash script, I'm looking for a way to set each matching line of a file into its own variable, or variable array.

As an example, i have a crontab file with several entries:

00 23 * * *...
1,949
Posted By lochraven
Excellent, Thank You. Can you guys recommend...
Excellent, Thank You.

Can you guys recommend a good book with good examples?

The one I have doesn't have the greatest examples.
1,949
Posted By lochraven
Ok, that makes sense. So how about I add to...
Ok, that makes sense.
So how about I add to that?
I was trying to do:
/X[0-9]/

But I'm not sure how to add an expression to the $0 ~ X
1,949
Posted By lochraven
awk -v X=$vname...
I have a simple script and I'm tring to pass a shell variable to awk.
Something like:

awk -v X=$vname '/X/ {print $4}' filename

However that doesn't seem to work.

awk -v X=$vname '{print...
4,391
Posted By lochraven
Thats the exact code with in a script. It...
Thats the exact code with in a script. It doesn't matter if he code is executed from the command line or with in a script.

There are messages being redirected from stdout and stderr, but the the...
4,391
Posted By lochraven
sfdisk -uM /dev/sdb >/dev/null 2>&1 <<EOF ,,L,*...
sfdisk -uM /dev/sdb >/dev/null 2>&1 <<EOF
,,L,*
EOF
4,391
Posted By lochraven
unable to redirect output
I have a script on Linux that is using sfdisk to partition a usb drive.

I'm trying to redirectory the standard out and standard error which works, however, there is still messages being diplayed....
2,900
Posted By lochraven
thats awesome, thanks to the both of you :) ...
thats awesome, thanks to the both of you :)

How about excluding 'root' from the output?
2,900
Posted By lochraven
who - uniq output
Hi,
I'd like to have a script what takes the 'who' output and grabs the user names and outputs just the user name, and no duplicates.

I know I could do something like:

who | awk '{print $1}'...
2,286
Posted By lochraven
Screen output
Is it possible to split the screen and show, lets say a local directory listing on the left and a remote directory listing on the right with shell scripting?

I know it's usually done with...
2,532
Posted By lochraven
PHP required check box
I am new to PHP scripting.

I have a page with a checkbox and I'd like to make it required before submiting

Here is the code I have for displaying:

<tr>
<td align="center"...
Forum: Ubuntu 08-28-2008
10,841
Posted By lochraven
MS basic compiler for linux
I have a client who's software is written in ms basic for xenix and compiled on SCO. They would like to get it running on Linux.

Does anyone know if there is a MS Basic compiler avialable for...
Forum: SCO 08-28-2008
11,120
Posted By lochraven
Was the new hard disk the same interface and...
Was the new hard disk the same interface and size?

You might want to try something like Lone-Tar /Rescue-Ranger to clone the disk.
40,477
Posted By lochraven
I let the fsck continue, answering 'y' to...
I let the fsck continue, answering 'y' to everything.
When it was finished I was able to mount the filesystem as ext2 and all data was still there.
40,477
Posted By lochraven
I've tried that and here is what happens: #...
I've tried that and here is what happens:

# fsck.ext3 -b 32768 /dev/sdb
Superblock has an invalid ext3 journal (inode 8).
Clear<y>?

I thought that command would update the superblock with a...
40,477
Posted By lochraven
Linux EXT3 superblock recovery
Is there a way to recover or rebuild the superblock of an ext3 filesystem with out loosing data?

Thanks
28,696
Posted By lochraven
One simple example: while read line do ...
One simple example:

while read line
do
do what you want here with $line
done < filename
6,649
Posted By lochraven
I see, I was trying to type fast and missed the...
I see, I was trying to type fast and missed the increment line...

Something I didn't realize though is "not quoting" if the variable is suppose to be an integer.

I usually typeset the variables...
2,043
Posted By lochraven
You will need to either manually load a tape via...
You will need to either manually load a tape via the control panel or use a utility such as 'mtx' to load a tape.

Then use tar to list or restore the tape.
ie: # tar tvf /dev/rmt/0
2,043
Posted By lochraven
What OS? How was the tape created? tar,...
What OS?

How was the tape created? tar, cpio, 3rd party utility?
Forum: Linux 08-21-2008
3,201
Posted By lochraven
Stair stepping
Is there a command line flag to lpr or a utility similar to the Unix 'xtod' command to fix stair stepping when printing?

Under Unix I would:

# cat textfile | xtod | lp -d lineprinter
...
6,649
Posted By lochraven
Heres something like what I have in a shell...
Heres something like what I have in a shell script:

. /data.file
anum="0"
while [ ! -z "${sg_name[${anum}]}" ]
do
echo "sg_name[${anum}]}"
echo "sg_size[${anum}]}"
echo...
6,649
Posted By lochraven
I'm familiar with using the '-v' flag to set...
I'm familiar with using the '-v' flag to set variables.

But I was wondering if it was possible to keep the same array structure in awk as it is in the shell.

I take it awk can not source that...
6,649
Posted By lochraven
shell / awk arrays
I have a bash shell script that sources a data file, the data file has array values such as:

#--data file ---#
sg_name[0]="db1"
sg_size[0]="12892"
sg_allow[0]="50000"

sg_name[1]="db2"...
2,931
Posted By lochraven
Ok ok, I got it now. I think my brain is a...
Ok ok, I got it now. I think my brain is a little slow today...being Friday and all :)

Thanks for the explaination, once again much appreciated.
Showing results 1 to 25 of 29

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