Sponsored Content
Top Forums Shell Programming and Scripting Modify text file using shell script Post 302526770 by ciupinet on Wednesday 1st of June 2011 12:13:31 PM
Old 06-01-2011
However if the values are not unique and not sorted, you can use the following:

Code:
echo "ABC 1
ABC 2
ABC 3
ABC 4
ABC 5" | awk '{if ($2 <= 3) {print "#"$0} else {print $0}}'

Works as well with:

Code:
echo "ABC 1
ABC 2
ABC 3
ABC 4
ABC 5
ABC 4
ABC 2" | awk '{if ($2 <= 3) {print "#"$0 } else {print $0}}'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Modify a text or xml file

Hi all, I want to write a shell which would allow me to edit a text file or a xml file. Basically i want to add a new node in a existing xml file. The values for this new node are based on user input. Thanks in advance Zing (9 Replies)
Discussion started by: zing
9 Replies

2. Shell Programming and Scripting

how to modify a file using shell script

Hi, i am using SuonOS and ksh. i need to add data into a file(s.txt) using a shell script. i have to pass 3 parameters and these 3 paramaters should add into the file at end of the file. File s.txt is look like, --------------------------------- column1|column2|column3 ... (1 Reply)
Discussion started by: syamkp
1 Replies

3. Shell Programming and Scripting

Need help to modify perl script: Text file with line and more than 1 space

Dear Friends, I am beginner in Perl and trying to find the problem in a script. Kindly help me to modify the script. My script is not giving the output for the last field and followed text (LA: Language English). Input file & script as follows: Input file: Thu Mar 19 2:34:14 EDT 2009 STC... (3 Replies)
Discussion started by: srsahu75
3 Replies

4. Shell Programming and Scripting

Help with a shell script to modify one line and copy the next 9 to same file

Hi everyone, the problem is quite simple, yet I can't find an easy solution using awk. I need to search for a string in $3, then if I find this string, copy the line,modify $3, and copy the next 9 lines to the same file. My problem is in the copying of the lines... Finding and modifying... (5 Replies)
Discussion started by: Teroc
5 Replies

5. UNIX for Dummies Questions & Answers

Modify Text File

Hi, I would like to remove any lines from a text file that begin with #, or that are blank. How can I do that with BASH? Mike (3 Replies)
Discussion started by: msb65
3 Replies

6. Shell Programming and Scripting

Read data from .csv file through shell script & modify

I need to read data from a file called "test.csv" through shell script where the file contains values like name,price,descriptor etc. There are rows where descriptor (& in some rows name) are written as string & other characters like "car_+" OR "bike*" etc where it should contains strings like... (3 Replies)
Discussion started by: raj100
3 Replies

7. Shell Programming and Scripting

Shell script to modify file in several directories

Hi, I want a script shell to automate modifying httpd.conf file for several instances of apache, save httpd.file before changing it, after modifying it and then restart apache. - Replace ServerRoot "xxxx" by ServerRoot "yyyy" of all directories : "... (4 Replies)
Discussion started by: bras39
4 Replies

8. Shell Programming and Scripting

Modify the text file by script

Hi All the Helpers! I have a text file which looks like input.txt.I would request to please suggest me how can I make this file look like output.txt input.txt VOP 111 0 1 2 DEM 111 0 222 333 444 555 879 888 987 888 989 VOP 118 0... (2 Replies)
Discussion started by: Indra2011
2 Replies

9. Shell Programming and Scripting

Modify text file using awk

I have text file with lines as shown here. Each row has 11 columns separated by tab. In each row, i want to split the 8th column such that the output should look like shown below. Here value in the 9th column is DP value and in the 10th column is MQ value followed by the values after resource.EFF=.... (15 Replies)
Discussion started by: mehar
15 Replies

10. Shell Programming and Scripting

Modify text file using sed

Hello all, I have some text files I need to do the following on: Delete banner page (lines 1-56) --I am doing this using sed Remove ^M --I am doing this using vi Remove trailer page --this can vary based on the contents of the file, it usually starts with *************************** I am... (5 Replies)
Discussion started by: jeffs42885
5 Replies
FS_LSMOUNT(1)						       AFS Command Reference						     FS_LSMOUNT(1)

NAME
       fs_lsmount - Reports the volume for which a directory is the mount point.

SYNOPSIS
       fs lsmount -dir <directory>+ [-help]

       fs ls -d <directory>+ [-h]

DESCRIPTION
       The fs lsmount command reports the volume for which each specified directory is a mount point, or indicates with an error message that a
       directory is not a mount point or is not in AFS.

       To create a mount point, use the fs mkmount command. To remove one, use the fs rmmount command.

OPTIONS
       -dir <directory>+
	   Names the directory that serves as a mount point for a volume. The last element in the pathname provided must be an actual name, not a
	   shorthand notation such as one or two periods ("." or "..").

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       If the specified directory is a mount point, the output is of the following form:

	  '<directory>' is a mount point for volume '<volume name>'

       where

       o   A number sign ("#") precedes the <volume name> string for a regular mount point.

       o   A percent sign ("%") precedes the <volume name> string for a read/write mount point.

       o   A cell name and colon (":") follow the number or percent sign and precede the <volume name> string for a cellular mount point.

       The fs mkmount reference page explains how the Cache Manager interprets each of the three types of mount points.

       If the directory is a symbolic link to a mount point, the output is of the form:

	  '<directory>' is a symbolic link, leading to a mount point for volume
	  '<volume name>'

       If the directory is not a mount point or is not in AFS, the output reads:

	  '<directory>' is not a mount point.

       If the output is garbled, it is possible that the mount point has become corrupted in the local AFS client cache. Use the fs flushmount
       command to discard it, which forces the Cache Manager to refetch the mount point.

EXAMPLES
       The following example shows the mount point for the home directory of user "smith":

	  % fs lsmount /afs/abc.com/usr/smith
	  '/afs/abc.com/usr/smith' is a mount point for volume '#user.smith'

       The following example shows both the regular and read/write mount points for the ABC Corporation cell's "root.cell" volume.

	  % fs lsmount /afs/abc.com
	  '/afs/abc.com' is a mount point for volume '#root.cell'

	  % fs lsmount /afs/.abc.com
	  '/afs/.abc.com' is a mount point for volume '%root.cell'

       The following example shows a cellular mount point: the State University cell's "root.cell" volume as mounted in the ABC Corporation cell's
       tree.

	  % fs lsmount /afs/stateu.edu
	  '/afs/stateu.edu' is a mount point for volume '#stateu.edu:root.cell'

PRIVILEGE REQUIRED
       The issuer must have the "l" (lookup) permission on the ACL of the root directory of the volume that houses the file or directory named by
       the -dir argument, and on the ACL of each directory that precedes it in the pathname.

SEE ALSO
       fs_flushmount(1), fs_mkmount(1), fs_rmmount(1)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							     FS_LSMOUNT(1)
All times are GMT -4. The time now is 05:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy