09-15-2006
Thanks for quick response! When I do this I get a bad substitution error... do I need to put the % or the *? What is their function?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How would I delete white spaces in a specified file?
Also, I'd like to know what command I would use to take something off a regular expression, and put it onto another.
ie.
.
.
.
expression1 <take_off>
.
.
.
expression2 (put here)
.
.
.
Any help would be great, thanks! (10 Replies)
Discussion started by: cary530
10 Replies
2. Shell Programming and Scripting
hi all...
i have the next question:
i have a flat file with a lot of records (lines). Each record has 10 fields, which are separated by pipe (|). My problem is what sometimes, in the first record, there are white spaces (no values, nothing) in the beginning of the record, like this:
ws ws... (2 Replies)
Discussion started by: DebianJ
2 Replies
3. Solaris
Hi my lovely friends,
Im writing one pgm in which i trying to assign some values like
$var='Jun 6'
but if i do echo of this $var will trim the spaces expect one space.
$echo $var
$Jun 6
But if var='Jun 28', then this will works fine
$echo $var
$Jun 28
this is required to exctract... (2 Replies)
Discussion started by: Lokesha
2 Replies
4. Shell Programming and Scripting
Hi,
Can anybody suggest me how to combine two strings with two or more white spaces and assign it to a variable?
E.g.
first=HAI
second=HELLO
third="$first $second" # appending strings with more than one white spaces
echo $third
this would print
HAI HELLO
Output appears... (2 Replies)
Discussion started by: harish_oty
2 Replies
5. UNIX for Advanced & Expert Users
Hi,
How can I remove the unwanted spaces in the line.
123456 789 ABC DEF. - I wanna remove the sapces in this line, I need the output 123456789ABCDEF.
Pls help me...... (3 Replies)
Discussion started by: sharif
3 Replies
6. UNIX for Dummies Questions & Answers
Dear Members,
Following is the code which i am using:
integer i=7
while ((i <= 10 ));
do
param=`echo $TEST_OUT | cut -d"^" -f$i`
a=`echo ${param}`
echo `echo $a | sed 's/+/ /g'`
(( i = i + 1));
done
From the above code TEST_OUT is a variable which has the following value:
... (1 Reply)
Discussion started by: sandeep_1105
1 Replies
7. Shell Programming and Scripting
friends,
I have a script in solaris 10 SPARC system which is like this
date '+Time: %m/%d/%y %H:%M:%S'
echo " GDBRR GDLRR GDBWR GDLWR GDRRR GDRWR "
sar -b 10 10 |/usr/xpg4/bin/awk '!/Average/ && !/SunOS/ && !/bread/ {$1="";T=$2;T1=$3;T2=$5;T3=$6;T4=$8;T5=$9}{print(T"\t",... (1 Reply)
Discussion started by: achak01
1 Replies
8. Shell Programming and Scripting
I have a file which contains certain records about users. the row length is always fixed to 205 characters.
Now I want to read each record line from the file, substring some portion out of it and put into another file. But I have observed that my script is trimming the extra spaces I have used for... (4 Replies)
Discussion started by: Pramit
4 Replies
9. Shell Programming and Scripting
Hi guys,
when I take substring of a particular data using this command
var=substr($0,11,10)
it comes with spaces, when I am trying to trim the spaces it is not allowing me to do that.
Can you please help me out on that.
As I have to reverse the output of the variable also.
---------- Post... (0 Replies)
Discussion started by: manish8484
0 Replies
10. Shell Programming and Scripting
Hi All,
I am using following script to name the file base of some values
#!/bin/sh
sourcefile=$1
awk '
BEGIN{ n = 1; name = "FILEFILE12" n ".txt"; }
{
if (substr($0,1,10) == "FILEFILE12")
{
close (name)
n++
a = substr($0,11,10);
b = substr($0,21,5);
name = b "_Src_" a ".txt"
}... (6 Replies)
Discussion started by: manish8484
6 Replies
badsect(8) System Manager's Manual badsect(8)
NAME
badsect - Creates files to contain bad sectors
SYNOPSIS
/usr/sbin/badsect bbdir sector...
DESCRIPTION
The badsect command makes a file to contain a bad sector. Normally, bad sectors are made inaccessible by the standard formatter, which
provides a forwarding table for bad sectors to the driver. If a driver supports the bad blocking standard, it is preferable to use that
method to isolate bad blocks because the bad block forwarding makes the disk appear perfect, and such disks can then be copied with dd(1).
The technique used by badsect is also less general than bad block forwarding, as badsect cannot make amends for bad blocks in the i-list of
file systems or in swap areas.
On some disks, adding a sector that is suddenly bad to the bad sector table currently requires the running of the standard formatter.
Thus, to deal with a newly bad block or on disks where the drivers do not support the bad-blocking standard, badsect can be used to good
effect.
Use the badsect command on a quiet file system in the following way: Mount the file system and change to its root directory. Make a direc-
tory BAD there. Run badsect, giving as argument the BAD directory followed by all the bad sectors you wish to add. (The sector numbers
must be relative to the beginning of the file system, as reported in console error messages.) Change back to the root directory, unmount
the file system, and run fsck(8) on the file system. The bad sectors should show up in two files or in the bad sector files and the free
list. Have fsck remove files containing the offending bad sectors, but do not have it remove the BAD/nnnnn files. This operation will
leave the bad sectors in only the BAD files.
The badsect command works by giving the specified sector numbers in a mknod(2) system call, creating an illegal file whose first block
address is the block containing bad sector and whose name is the bad sector number. When fsck discovers the file, it will ask "HOLD BAD
BLOCK?" An affirmative response will cause fsck to convert the inode to a regular file containing the bad block.
RESTRICTIONS
If more than one of the sectors comprised by a file system fragment are bad, you should specify only one to badsect, as the blocks in the
bad sector files cover all the sectors in a file system fragment.
ERRORS
The badsect command refuses to attach a block that resides in a critical area or is out of range of the file system. A warning is issued
if the block is already in use.
SEE ALSO
Commands: fsck(8)
badsect(8)