09-26-2013
Substitute the sequence
- , ... one comma
- [ ]* ... zero or more blanks
- ? ... a question mark
- [ ]* ... zero or more blanks
- , ... one comma
with
- , , ... the string comma-blank-comma
and
g ... do it for all matches in a line, not only the first
These 2 Users Gave Thanks to hergp For This Post:
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have a .htaccess file as follows... No I want to comment the last line ( in this case.. it may not be a last line for other cases).. please advise how to add a # (comment infront of "Options All -Indexes" not assuming this line to be the last line using sed.
root@server1 # cat... (13 Replies)
Discussion started by: fed.linuxgossip
13 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
I have few question related to Unix environment and commands :
1. what is .chrc file contain and if it is not present then what happens.
2. what is .login file contain,in which dir it is present and what all other uses are their for this file
3. how and who calls .profile when you... (2 Replies)
Discussion started by: ravi.sadani19
2 Replies
3. Shell Programming and Scripting
Hi Friends!!
I want to add a / at the end of a number. for example i have CQ65758 /, in this case i want to shift that backspace one space to the left so the my result becomes CQ65758/.
How can i do that with sed.
Thanks
Adi (3 Replies)
Discussion started by: asirohi
3 Replies
4. Shell Programming and Scripting
Hi,
I have 3 doubts which I posted it here.
Doubt 1:
I have a file containing data:
22 -73 89 10
99 21 15 -77
23 63 -80 91
-22 65 28 97
I am trying to print the fields in the reverse order and replace every field by its absolute (positive) value
(ie.) I am looking for output:
10... (8 Replies)
Discussion started by: royalibrahim
8 Replies
5. Shell Programming and Scripting
Greetings all. :)
I would like to use sed to join all non-blank lines together in a particular file. I was thinking I could do this by simply replacing the terminating, new-line character on every line which is not blank, but I must be missing something in my sed line:
$ sed... (3 Replies)
Discussion started by: SteveB-in-LV
3 Replies
6. Shell Programming and Scripting
Please have a look at below examples. Why do these 3 sed commands deliver the same result? Especially, why are there 4 "x" in the result instead of 3?
1.
echo "abc" | sed 's/d*/x/g'
xaxbxcx
2.
echo "abc" | sed 's/d*/&x/g'
xaxbxcx
3.
echo "abc" | sed 's/d*/x&/g'
xaxbxcx
Thanks for... (2 Replies)
Discussion started by: Werner Gross
2 Replies
7. UNIX for Dummies Questions & Answers
Hi ,
what is the equivalent of below awk in sed.
awk '$1=="ABC"&&$2=="XYZ" {print $0}' infile
Thanks,
Shruthi (6 Replies)
Discussion started by: shruthidwh
6 Replies
8. UNIX for Dummies Questions & Answers
Hi,
A basic sed question.
I have a set of files. In each file there is a number that I want replaced. For example, if I run sed I should get the following:
% cat test2.txt
#goofy//171.00
goofy 171.00
% sed -i 's/171/xxx/g' test2.txt
% cat test2.txt
#goofy//xxx.00
goofy xxx.00
... (2 Replies)
Discussion started by: pc2001
2 Replies
LEARN ABOUT CENTOS
scsi-rescan
RESCAN-SCSI-BUS.SH(1) User Commands RESCAN-SCSI-BUS.SH(1)
NAME
rescan-scsi-bus.sh - script for adding and removing SCSI devices without rebooting
SYNOPSIS
rescan-scsi-bus.sh [options] [host [host ...]]
OPTIONS
-a, --alltargets
scan all targets, not just currently existing [default: disabled]
-d enable debug [default: 0]
-l activates scanning for LUNs 0--7 [default: 0]
-L NUM activates scanning for LUNs 0--NUM [default: 0]
-w, --wide
scan for target device IDs 0--15 [default: 0--7]
-c enables scanning of channels 0 1 [default: 0 / all detected ones]
-r, --remove
enables removing of devices [default: disabled]
-f, --flush
flush failed multipath devices [default: disabled]
-i, --issue-lip
issue a FibreChannel LIP reset [default: disabled]
-u, --update
look for existing disks that have been remapped
-s, --resize
look for resized disks and reload associated multipath devices, if applicable
--forcerescan
rescan existing devices
--forceremove
remove and readd every device (DANGEROUS)
--nooptscan
don't stop looking for LUNs is 0 is not found
--color
use coloured prefixes OLD/NEW/DEL
--hosts=LIST
scan only host(s) in LIST
--channels=LIST
scan only channel(s) in LIST
--ids=LIST
scan only target ID(s) in LIST
--luns=LIST
scan only lun(s) in LIST
--sync, --nosync
issue a sync / no sync [default: sync if remove]
--attachpq3
tell kernel to attach sg to LUN 0 that reports PQ=3
--reportlun2
tell kernel to try REPORT_LUN even on SCSI2 devices
--largelun
tell kernel to support LUNs > 7 even on SCSI2 devs
--sparselun
tell kernel to support sparse LUN numbering
Host numbers may thus be specified either directly on cmd line (deprecated) or or with the --hosts=LIST parameter (recommended).
LIST: A[-B][,C[-D]]... is a comma separated list of single values and ranges (No spaces allowed.)
SEE ALSO
rescan-scsi-bus.sh Homepage: http://www.garloff.de/kurt/linux/#rescan-scsi
sg3_utils Homepage: http://sg.danny.cz/sg
rescan-scsi-bus.sh 1.57 leden 2014 RESCAN-SCSI-BUS.SH(1)