08-07-2012
I'm sure it is, but ed is the more logical choice for editing a file (no need to explicitly write to a second file which then needs to clobber the original).
Regards,
Alister
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How to change ip using awk or sed .
#cat /etc/hosts
10.151.5.1 server1
10.151.5.2 server2
10.151.5.3 server3
10.151.5.4 server4
10.151.5.5 server5
Output:
10.151.5.1 server1
10.181.5.2 server2
10.151.5.3 server3
10.181.5.4 server4
10.181.5.5 server5 (9 Replies)
Discussion started by: kenshinhimura
9 Replies
2. Shell Programming and Scripting
Hi, i want to change a subs. value in a file, with using a script..
this is my script... (example)
#!/bin/bash
NDIR=`zenity --file-selection --directory`
mv $HOME/Desktop/myfile /tmp/myfile.temp
XT='"'
perl -pe "s/.*/DIR=$XT`echo -e "$NDIR"`$XT/ if $. == 40" <... (2 Replies)
Discussion started by: excsra
2 Replies
3. Shell Programming and Scripting
Hi Gurus,
I am working with a korn shell script. I should replace in a very great file the character ";" with a space.
Example:
2750;~
2734;~
2778;~
2751;~
2751;~
2752;~
what the fastest method is? Sed? Awk?
Speed is dead main point, Seen the dimensions of the files
Thanks (6 Replies)
Discussion started by: GERMANICO
6 Replies
4. Shell Programming and Scripting
Hi,
Need help with a sed command that I am using to substitute 3 positions of a pipe delimited file.
i am getting different results while substituting the same position of two different files with the same value. Please see details below:
$ cat chk2
... (3 Replies)
Discussion started by: vmenon
3 Replies
5. Shell Programming and Scripting
Hi guys,
been scratching round the forums and my mountain of resources.
Maybe I havn't read deep enough
My question is not how sed edits a stream and outputs it to a file, rather something like this below:
I have a .txt with some text in it :rolleyes:
abc:123:xyz
123:abc:987... (7 Replies)
Discussion started by: the0nion
7 Replies
6. Shell Programming and Scripting
Hi,
I have file1 like this:
a 64
b 66
c 67and file2 like this:
@1234
1123
aabbcc
@5453
5543
ccbaI want to replace each letter of the third line in file2 with corresponding number in file1. So desired output is,
@1234
1123
646466666767
@5453
5543
67676664I tried something like... (4 Replies)
Discussion started by: polsum
4 Replies
7. Shell Programming and Scripting
Hello.
I am trying to modify a config file which is in windows *.ini type file.
I have found a piece of code here :linux - Edit file in unix using SED - Stack Overflow
As I can't make it doing the job , I am trying to find a solution step by step.
here a modified sample file : my_sample.ini... (1 Reply)
Discussion started by: jcdole
1 Replies
8. Shell Programming and Scripting
I have a csv file formatted like this:
2014-08-21 18:06:26,A,B,12345,123,C,1232,26/08/14 18:07and I'm trying to change it to MM/DD/YYYY HH:MM for both occurances.
I have got this:
awk -F, 'NR <=1 {print;next}{"date +%d/%m/%Y\" \"%H:%m -d\""$1 "\""| getline dte;$1=dte}1' OFS="," test.csvThis... (6 Replies)
Discussion started by: say170
6 Replies
9. Shell Programming and Scripting
OSX
I have been grinding my teeth on a portion of code. I am building a bash script that edits a html email template. In the template, I have place holders for SED (or whatever program is appropriate) to use as anchors for find and replace, with user defined corresponding html code. The HTML code... (3 Replies)
Discussion started by: sudo
3 Replies
10. UNIX for Beginners Questions & Answers
Hi I want to use sed to change a text files input into an awk script.
For example if the input says " chord -- english " I want to change this using sed 's/pattern 1 /pattern 2 /'g filename but I don't understand how to use part of the pattern 1 to input that into pattern 2 . Like after... (10 Replies)
Discussion started by: enforcer
10 Replies
LEARN ABOUT SUSE
lvdisplay
LVDISPLAY(8) System Manager's Manual LVDISPLAY(8)
NAME
lvdisplay - display attributes of a logical volume
SYNOPSIS
lvdisplay [-a|--all] [-c|--colon] [-d|--debug] [-h|-?|--help] [--ignorelockingfailure] [--maps] [--nosuffix] [-P|--partial] [--units hHbB-
sSkKmMgGtTpPeE] [-v|--verbose] [--version] [LogicalVolumePath [LogicalVolumePath...]]
lvdisplay --columns | -C [--aligned] [-a|--all] [-d|--debug] [-h|-?|--help] [--ignorelockingfailure] [--noheadings] [--nosuffix]
[-o|--options [+]Field[,Field]] [-O|--sort [+|-]Key1[,[+|-]Key2[,...]]] [-P|--partial] [--segments] [--separator Separator] [--unbuffered]
[--units hHbBsSkKmMgGtTpPeE] [-v|--verbose] [--version] [LogicalVolumePath [LogicalVolumePath...]]
DESCRIPTION
lvdisplay allows you to see the attributes of a logical volume like size, read/write status, snapshot information etc.
lvs (8) is an alternative that provides the same information in the style of ps (1). lvs is recommended over lvdisplay.
OPTIONS
See lvm for common options and lvs for options given with --columns.
--all Include information in the output about internal Logical Volumes that are components of normally-accessible Logical Volumes, such as
mirrors, but which are not independently accessible (e.g. not mountable). For example, after creating a mirror using 'lvcreate -m1
--mirrorlog disk', this option will reveal three internal Logical Volumes, with suffixes mimage_0, mimage_1, and mlog.
-c, --colon
Generate colon separated output for easier parsing in scripts or programs. N.B. lvs (8) provides considerably more control over the
output.
The values are:
* logical volume name
* volume group name
* logical volume access
* logical volume status
* internal logical volume number
* open count of logical volume
* logical volume size in sectors
* current logical extents associated to logical volume
* allocated logical extents of logical volume
* allocation policy of logical volume
* read ahead sectors of logical volume
* major device number of logical volume
* minor device number of logical volume
-m, --maps
Display the mapping of logical extents to physical volumes and physical extents. To map physical extents to logical extents use
pvs --segments -o+lv_name,seg_start_pe,segtype.
--columns | -C
Display output in columns, the equivalent of lvs. Options listed are the same as options given in lvs (8).
Examples
"lvdisplay -v /dev/vg00/lvol2" shows attributes of that logical volume. If snapshot logical volumes have been created for this original
logical volume, this command shows a list of all snapshot logical volumes and their status (active or inactive) as well.
"lvdisplay /dev/vg00/snapshot" shows the attributes of this snapshot logical volume and also which original logical volume it is associated
with.
SEE ALSO
lvm(8), lvcreate(8), lvscan(8), pvs(8)
Sistina Software UK LVM TOOLS 2.02.67(2) (2010-06-04) LVDISPLAY(8)