Sponsored Content
Top Forums Shell Programming and Scripting sed command to append word at end of line Post 303022741 by ghpradeep on Thursday 6th of September 2018 02:53:13 AM
Old 09-06-2018
hello,

basically i want search particular filesystem(eg. /data) is having nodev parameter set or not using mount command.
mount |grep /data

if /data does not have nodev parameter then it should add into /etc/fstab file. if its already there in mount command output then it will ignore it.

In the fstab file, its should be add in fourth column with existing option.

original output:
Code:
/dev/mapper/rootvg-homelv /home           ext4    noatime,defaults        0       2

require output:
Code:
/dev/mapper/rootvg-homelv /home           ext4    noatime,defaults,nodev        0       2

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

using sed to append text to the end of each line

Anyone know how to use SED to append a comma to the end of each line example: field1,field2,field3,field4 If i Cat /textfile ---- How can i append the end of /textfile with a comman? (8 Replies)
Discussion started by: Redg
8 Replies

2. Shell Programming and Scripting

sed append "\n" to end of every line in file

I know it sounds simple, but I want to e-mail the last 6 lines of a log file, which I have tailed into logresults.txt. I'm using echo -e "Subject:server results\nFrom:server log <user@domain.com>\n"`cat logresults.txt` | sendmail -t user@domain.com which works, but the body of the e-mail has... (4 Replies)
Discussion started by: unclecameron
4 Replies

3. Shell Programming and Scripting

Sed : identify a pattern and append a word at the end of a line

Hello to all, On aix, I want to identify a term on a line in a file and then add a word at the end of the line identified. I do not want the word to be added when the line contains the symbol "#". I use the following command, but it deletes the term identified then adds the word. #sed... (4 Replies)
Discussion started by: dantares
4 Replies

4. Shell Programming and Scripting

Using sed command to change end of line

I am looking to change a data file into a javascript string and this is the code that I am using: sed -i '' -e 's/^/str += "/' -e 's/$/";/' file.xml The first part -e 's/^/str += "/' works as intended, but the second part -e 's/$/";/' adds an additional newline to my file, so that instead of... (3 Replies)
Discussion started by: figaro
3 Replies

5. Shell Programming and Scripting

append "awk command" to the end of each line

hi; this is my qqq.mos: l ./gcsw 86.0.0.1 'lt all;l+;lset SectorPort=860 Tilt 861;l-' l ./gcsw 86.0.0.2 'lt all;l+;lset SectorPort=862 Tilt 863;l-' l ./gcsw 86.0.0.3 'lt all;l+;lset SectorPort=864 Tilt 865;l-' ... i want to append;l nawk 'NR==14 && $NF!="Set."{print "l ./gcsw "r"... (4 Replies)
Discussion started by: gc_sw
4 Replies

6. Shell Programming and Scripting

Append the text file with comma at the end of every word

Hi folks, Using shell, I am trying the append comma to every line of text. the requirement is like, I have to open the txt file in unix and read line by line and should add comma at the end of every word to make it single line txt file ------- abc@gmail.com bcd@gmail.com... (7 Replies)
Discussion started by: giridhar276
7 Replies

7. Shell Programming and Scripting

How to append something to a word using sed command

Hi, How to append something to already existing word. Suppose, I have the following line as a part of a file. VVV= jdbc:... (6 Replies)
Discussion started by: Dpu
6 Replies

8. Shell Programming and Scripting

SED and Solaris Append line to the end of File does not work

Hello, I have to add a new line at the end of a File on Solaris-System: I think my script should be right, because I evaluated it to other threads. However the script does not what I am expected it should do. My file might look like this: Line1 Line2 Line3 And my script could... (7 Replies)
Discussion started by: Timo_HR
7 Replies

9. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

10. Shell Programming and Scripting

How to append word count at end of file?

Hi guys, I have to append the word count of a file at the end of the file name like this - > "filename_2345" where 2345 is the word count of "filename". How do i achieve this using one command ? I am not allowed to store the word count in a variable and then concatenate. Request your... (1 Reply)
Discussion started by: peter2312
1 Replies
FSTAB(5)							   File Formats 							  FSTAB(5)

NAME
fstab - static information about the filesystems SYNOPSIS
/etc/fstab DESCRIPTION
The file fstab contains descriptive information about the filesystems the system can mount. fstab is only read by programs, and not writ- ten; it is the duty of the system administrator to properly create and maintain this file. The order of records in fstab is important because fsck(8), mount(8), and umount(8) sequentially iterate through fstab doing their thing. Each filesystem is described on a separate line. Fields on each line are separated by tabs or spaces. Lines starting with '#' are com- ments. Blank lines are ignored. The following is a typical example of an fstab entry: LABEL=t-home2 /home ext4 defaults,auto_da_alloc 0 2 The first field (fs_spec). This field describes the block special device or remote filesystem to be mounted. For ordinary mounts, it will hold (a link to) a block special device node (as created by mknod(8)) for the device to be mounted, like `/dev/cdrom' or `/dev/sdb7'. For NFS mounts, this field is <host>:<dir>, e.g., `knuth.aeb.nl:/'. For filesystems with no storage, any string can be used, and will show up in df(1) output, for example. Typical usage is `proc' for procfs; `mem', `none', or `tmpfs' for tmpfs. Other special filesystems, like udev and sysfs, are typically not listed in fstab. LABEL=<label> or UUID=<uuid> may be given instead of a device name. This is the recommended method, as device names are often a coincidence of hardware detection order, and can change when other disks are added or removed. For example, `LABEL=Boot' or `UUID=3e6be9de-8139-11d1-9106-a43f08d823a6'. (Use a filesystem-specific tool like e2label(8), xfs_admin(8), or fatlabel(8) to set LABELs on filesystems). It's also possible to use PARTUUID= and PARTLABEL=. These partitions identifiers are supported for example for GUID Partition Table (GPT). See mount(8), blkid(8) or lsblk(8) for more details about device identifiers. Note that mount(8) uses UUIDs as strings. The string representation of the UUID should be based on lower case characters. The second field (fs_file). This field describes the mount point (target) for the filesystem. For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces or tabs these can be escaped as `40' and '11' respectively. The third field (fs_vfstype). This field describes the type of the filesystem. Linux supports many filesystem types: ext4, xfs, btrfs, f2fs, vfat, ntfs, hfsplus, tmpfs, sysfs, proc, iso9660, udf, squashfs, nfs, cifs, and many more. For more details, see mount(8). An entry swap denotes a file or partition to be used for swapping, cf. swapon(8). An entry none is useful for bind or move mounts. More than one type may be specified in a comma-separated list. mount(8) and umount(8) support filesystem subtypes. The subtype is defined by '.subtype' suffix. For example 'fuse.sshfs'. It's recommended to use subtype notation rather than add any prefix to the first fstab field (for example 'sshfs#example.com' is depre- cated). The fourth field (fs_mntops). This field describes the mount options associated with the filesystem. It is formatted as a comma-separated list of options. It contains at least the type of mount (ro or rw), plus any additional options appropriate to the filesystem type (including performance-tuning options). For details, see mount(8) or swapon(8). Basic filesystem-independent options are: defaults use default options: rw, suid, dev, exec, auto, nouser, and async. noauto do not mount when "mount -a" is given (e.g., at boot time) user allow a user to mount owner allow device owner to mount comment or x-<name> for use by fstab-maintaining programs nofail do not report errors for this device if it does not exist. The fifth field (fs_freq). This field is used by dump(8) to determine which filesystems need to be dumped. Defaults to zero (don't dump) if not present. The sixth field (fs_passno). This field is used by fsck(8) to determine the order in which filesystem checks are done at boot time. The root filesystem should be specified with a fs_passno of 1. Other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. Defaults to zero (don't fsck) if not present. NOTES
The proper way to read records from fstab is to use the routines getmntent(3) or libmount. The keyword ignore as a filesystem type (3rd field) is no longer supported by the pure libmount based mount utility (since util-linux v2.22). FILES
/etc/fstab, <fstab.h> SEE ALSO
getmntent(3), fs(5), findmnt(8), mount(8), swapon(8) HISTORY
The ancestor of this fstab file format appeared in 4.0BSD. AVAILABILITY
This man page is part of the util-linux package and is available from https://www.kernel.org/pub/linux/utils/util-linux/. util-linux February 2015 FSTAB(5)
All times are GMT -4. The time now is 02:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy