12-07-2004
reading file
Hi
I ‘m trying to write a simple script that will be able to extract some useful info from a file of this format:
+ 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610
- 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610
r 1.84471 2 1 cbr 210 ------- 1 3.0 1.0 195 600
r 1.84566 2 0 ack 40 ------- 2 3.2 0.1 82 602
+ 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611
- 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611
r 1.84609 0 2 cbr 210 ------- 0 0.0 3.1 225 610
+ 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610
d 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610
- 1.8461 2 3 cbr 210 ------- 0 0.0 3.1 192 511
r 1.84612 3 2 cbr 210 ------- 1 3.0 1.0 196 603
+ 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603
- 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603
+ 1.84625 3 2 cbr 210 ------- 1 3.0 1.0 199 612
For example I want to extract the information in column 18-22 but say only the number values (not necessarily all at once).
Using cut utility (i.e. cut -d 18-22 filename) I get
210
210
210
40 -
1000
1000
210
210
210
210
210
210
210
210
But I only need the value without the - character
In other word for each line I need the field value and I cant use [ cut -f ] because there only separated by spaces.
Any ideas or know of a good Unix tutorial for beginners.
Thanks
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
How can i dynamically read files names from a list file and execute them from a single shell script.
Please help its urgent
Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
2. UNIX for Advanced & Expert Users
Hi Gurus,
I am having an requirement. i have to read a list file which contains file names and send mail to different users based on the files in the list file.
eg. if file a.txt exists then send a mail to a@a.com
simillary for b.txt,c.txt etc.
Thanks for your help,
Nimu (6 Replies)
Discussion started by: nimu1979
6 Replies
3. UNIX for Dummies Questions & Answers
hi
I have a shell script say primary.sh . There is a file called params
my scenario is
primary.sh should read all the values and echo it
for example
i should pass like
$primary.sh params
output would be
Abc
... (2 Replies)
Discussion started by: ssuresh1999
2 Replies
4. Shell Programming and Scripting
Need to develop a unix shell script for the below requirement and I need your assistance:
1) search for file.log and file.bad file in a directory and read them
2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file
4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies
5. Shell Programming and Scripting
Hi,
I am running this command through a shell script and getting the error mentioned in the subject line:
testing.awk -f x.txt TNAME
My testing.awk file contains something like
++++++++++++++++++
#!/usr/bin/awk -f
BEGIN{
TAB_NAME="INSERT_ONE_" ARGV ;
}
if ( $1=="JAM_ONE" &&... (1 Reply)
Discussion started by: kunwar
1 Replies
6. Shell Programming and Scripting
Hi All
I have written the following script:
#!/bin/ksh
while read cmdline
do
echo `$cmdline`
pid="$cmdline"
done<commands.txt
===========
commands.txt contains:
ps -ef | grep abc | grep xyz |awk '{print $2};
My objective is to store the o/p of the command in a variable and do... (8 Replies)
Discussion started by: rahulparo
8 Replies
7. UNIX for Dummies Questions & Answers
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies
8. UNIX for Dummies Questions & Answers
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies
9. Shell Programming and Scripting
So I'm stumped.
First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes.
I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies
LEARN ABOUT HPUX
vxconfigrestore
vxconfigrestore(1M) vxconfigrestore(1M)
NAME
vxconfigrestore - restore disk group configuration
SYNOPSIS
/etc/vx/bin/vxconfigrestore [-c | -d | -n | -p] [-l directory] {dgname | dgid}
DESCRIPTION
The vxconfigrestore utility is used to restore a disk group's configuration information if this has been lost or become corrupted. The
disk group whose configuration is to be restore is specified either by name or by ID.
Any disks whose private region headers have become corrupted are reinstalled when the disk group configuration is restored. If you choose
not to reinstall the VxVM headers for these disks, it may not be possible to restore the disk group.
The disk group configuration backup files may have been automatically created by the vxconfigbackupd daemon, or manually by running the
vxconfigbackup command.
Restoration of a disk group configuration has two stages: precommit and commit. The precommit stage allows you to temporarily load the con-
figuration that is to be restored, and examine it using the vxprint utility. At this stage, the disk group configuration is read-only. No
permanent changes are written to disk until you choose to commit them. If desired, you can abandon the restore operation at the precommit
stage.
OPTIONS
-c (Commit) Permanently commits changes to the disks. The restoration must be at the precommit stage for this command to succeed.
Volumes are synchronized in the background. For large volume configurations, it may take some time to perform the synchroniza-
tion. You can use the vxtask -l list command to monitor the progress of this operation.
-d (Decommit) Abandons the restore operation at the precommit stage.
-n (Precommit: no installation of VxVM disk header) Loads the disk group configuration at the precommit stage. This option speci-
fies that disks whose private region headers have become corrupted are not to be reinstalled.
-l directory
Specifies a directory other than the default (/etc/vx/cbr/bk) where the backup configuration files are located.
-p (Precommit: load) Loads the disk group configuration at the precommit stage. This option specifies that disks whose private
region headers have become corrupted are to be reinstalled. The vxprint command can be used to examine the disk group configura-
tion.
Note: The volumes have not yet been synchronized at this stage.
This is the default operation if no option is specified.
EXAMPLES
Load the configuration of the mydg disk group from the default directory, and reinstall disks that have corrupted VxVM disk headers:
vxconfigrestore -p mydg
Load the configuration of the mydg1 disk group from the backup files in the directory /dgbackup/mydg1 without reinstalling any disks that
have corrupted private region disk headers:
vxconfigrestore -n -l /dgbackup/mydg1 mydg1
Abandon the restoration of the mydg2 disk group at the precommit stage:
vxconfigrestore -d -l /dgbackup/mydg2 mydg2
Commit the restoration of the configuration of the mydg disk group from the backup files in the directory /dgbackup/mydg:
vxconfigrestore -c -l /dgbackup/mydg mydg
FILES
/etc/vx/cbr/bk/dgname.dgid/dgid.dginfo
Default location of backup file for disk group information.
/etc/vx/cbr/bk/dgname.dgid/dgid.diskinfo
Default location of backup file for disk attributes.
/etc/vx/cbr/bk/dgname.dgid/dgid.binconfig
Default location of backup file for binary configuration copy.
/etc/vx/cbr/bk/dgname.dgid/dgid.cfgrec
Default location of backup file for configuration records in vxprint -m format.
NOTES
A disk group must be restored on the same physical disks as are defined in the configuration backup files.
The disk group configuration backup and restore utilities do not save any data in the public region. This includes file system or other
application data that is configured within VxVM objects.
A shared disk group in a cluster is restored as a private disk group. After the commit phase has completed, you can deport the private
disk group and re-import it as a shared disk group.
SEE ALSO
vxconfigbackup(1M), vxconfigbackupd(1M)
VxVM 5.0.31.1 24 Mar 2008 vxconfigrestore(1M)