Sponsored Content
Top Forums Programming Need to modify contents of file with complex patterns. Post 302434823 by success on Monday 5th of July 2010 10:16:44 AM
Old 07-05-2010
Need to modify contents of file with complex patterns

Quote:
Originally Posted by ygemici
Code:
# sed 's: /var1: /var:;s: /flx1: /flx:'  infile
/dev/vg0/var1 /var ext3 defaults 0 2
/dev/vg0/flx1 /flx ext3 defaults 0 2
/dev/vg0/var /var ext3 defaults 0 1
/dev/vg0/flx /flx ext3 defaults 0 2

Hi ,
Thanks for the solution, it modifies the lines with /var1 to /var and /flx1 to /flx respectively, But how to delete the lines with /dev/vg0/var and /dev/vg0/flx. when i use "grep -v /dev/vg0/var " for deletion bothe the lines with /dev/vg0/var1 and /dev/vg0/var are getting deleted. even sed for deletion is causing the same problem.

Please suggest a way for deleting only the lines with /dev/vg0/var and /dev/vg0/flx.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to modify the contents of file using script

Hi, Can anyone pls let me know how can i modify the file contents thru script. Eg. I have file abc.dat that contains below lines Merge.resync.cycleFlag Merge.resync.logFlag Merge.resync.maxByteRate Merge.resync.maxSearch Merge.resync.rate Merge.resync.tickLog ... (2 Replies)
Discussion started by: sdosanjh
2 Replies

2. Shell Programming and Scripting

Searching patterns in 1 file and deleting all lines with those patterns in 2nd file

Hi Gurus, I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies

3. Shell Programming and Scripting

sed: How to modify files in a complex way

Hello, I am new to sed and hope that someone can help me with the following task. I need to modify a txt file which has format like this: xy=CreateDB|head.queue|head.source|head.definition|rtf.edit|rtf.task|rft.cut abc|source|divine|line4|5|true into something like: head.queue=abc... (19 Replies)
Discussion started by: pinkypunky
19 Replies

4. UNIX for Advanced & Expert Users

How do I modify file contents?

I have a table output in a text file (abc.txt)as follows col1 , col2 , col3 , col4 , Here I want to modify this file as follows col1 '~!#', col2 '~!#', col3 '~!#', col3 '^@\n' Could you help on this??? Thanks Kris (1 Reply)
Discussion started by: mkris
1 Replies

5. UNIX for Dummies Questions & Answers

How to modify lines without certain patterns?

I have file like this: rs111 A T 0.9 0.8 ... rs112 AT T 0.8 0.2 ... rs113 G CT 0.9 0.1... I wish to replace all the NONE "A" or "T" or "G" or "C" values in column 3 and column 4 to " ", how can I do this? thanks! (8 Replies)
Discussion started by: luoruicd
8 Replies

6. Shell Programming and Scripting

Grab contents between two matched patterns

I am wanting to fetch the content of the table within a file the table begins with data label like N Batch Mn(I) RMSdev I/rms Rmerge Number Nrej Cm%poss AnoCmp MaxRes CMlplc SmRmerge SmMaxRes $$ $$ . #columns of data . . . . . $$ I tried the command awk... (18 Replies)
Discussion started by: piynik
18 Replies

7. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

8. Shell Programming and Scripting

Grab contents between two patterns

Hi, What is the best approach to grab contents between Changes Dependencies from the following example snippy Changes in packages about to be updated: bash-3.2-32.el5_9.1.x86_64 * Thu Jun 27 22:00:00 2013 Roman Rakus <rrakus@redhat.com> - 3.2-32.1 - Fixed a bug that caused... (2 Replies)
Discussion started by: ashokvpp
2 Replies

9. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
mkfs.gfs2(8)						      System Manager's Manual						      mkfs.gfs2(8)

NAME
mkfs.gfs2 - Make a GFS2 filesystem SYNOPSIS
mkfs.gfs2 [OPTION]... DEVICE [ block-count ] DESCRIPTION
mkfs.gfs2 is used to create a Global File System. OPTIONS
-b BlockSize Set the filesystem block size to BlockSize (must be a power of two). The minimum block size is 512. The FS block size cannot exceed the machine's memory page size. On the most architectures (i386, x86_64, s390, s390x), the memory page size is 4096 bytes. On other architectures it may be bigger. The default block size is 4096 bytes. In general, GFS2 filesystems should not deviate from the default value. -c MegaBytes Initial size of each journal's quota change file -D Enable debugging output. -h Print out a help message describing available options, then exit. -J MegaBytes The size of the journals in Megabytes. The default journal size is 128 megabytes. The minimum size is 8 megabytes. -j Number The number of journals for gfs2_mkfs to create. You need at least one journal per machine that will mount the filesystem. If this option is not specified, one journal will be created. -K Keep, do not attempt to discard blocks at mkfs time (discarding blocks initially is useful on solid state devices and sparse / thin-provisioned storage). -O This option prevents gfs2_mkfs from asking for confirmation before writing the filesystem. -o Specify extended options. Multiple options can be separated by commas. Valid extended options are: help Display an extended options help summary, then exit. sunit=bytes This is used to specify the stripe unit for a RAID device or striped logical volume. This option ensures that resource groups will be stripe unit aligned and overrides the stripe unit value obtained by probing the device. This value must be a multiple of the file system block size and must be specified with the swidth option. swidth=bytes This is used to specify the stripe width for a RAID device or striped logical volume. This option ensures that resource groups will be stripe aligned and overrides the stripe width value obtained by probing the device. This value must be a multiple of the sunit option and must also be specified with it. align=[0|1] Disable or enable the alignment of resource groups. The default behaviour is to align resource groups to the stripe width and stripe unit values obtained from probing the device or specified with the swidth and sunit extended options. -p LockProtoName LockProtoName is the name of the locking protocol to use. Acceptable locking protocols are lock_dlm (for shared storage) or if you are using GFS2 as a local filesystem (1 node only), you can specify the lock_nolock protocol. If this option is not specified, lock_dlm protocol will be assumed. -q Be quiet. Don't print anything. -r MegaBytes gfs2_mkfs will try to make Resource Groups about this big. Minimum RG size is 32 MB. Maximum RG size is 2048 MB. A large RG size may increase performance on very large file systems. If not specified, mkfs.gfs2 will choose the RG size based on the size of the file system: average size file systems will have 256 MB RGs, and bigger file systems will have bigger RGs for better performance. -t LockTableName The lock table field appropriate to the lock module you're using. It is clustername:fsname. Clustername must match that in clus- ter.conf; only members of this cluster are permitted to use this file system. Fsname is a unique file system name used to distin- guish this GFS2 file system from others created (1 to 16 characters). Lock_nolock doesn't use this field. Valid clusternames and fsnames may only contain alphanumeric characters, hyphens (-) and underscores (_). -V Print program version information, then exit. [ block-count ] Make the file system this many blocks in size. If not specified, the entire length of the specified device is used. EXAMPLE
gfs2_mkfs -t mycluster:mygfs2 -p lock_dlm -j 2 /dev/vg0/mygfs2 This will make a Global File System on the block device "/dev/vg0/mygfs2". It will belong to "mycluster" and register itself as wanting locking for "mygfs2". It will use DLM for locking and make two journals. gfs2_mkfs -t mycluster:mygfs2 -p lock_nolock -j 3 /dev/vg0/mygfs2 This will make a Global File System on the block device "/dev/vg0/mygfs2". It will belong to "mycluster" and but have no cluster locking. It will have three journals. mkfs.gfs2(8)
All times are GMT -4. The time now is 03:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy