Sponsored Content
Top Forums Shell Programming and Scripting Need help on find and replacement on specific line and position Post 302883905 by Rajesh_us on Thursday 16th of January 2014 03:28:57 PM
Old 01-16-2014
Quote:
Originally Posted by Don Cragun
Maybe you didn't realize that if you change all occurrences of A to Z and then change all occurrences of Z to A, everything that was an A or a Z in the original input will be an A in the output. The sequences of gsub() calls that you have translate Z through N to A through M, z through n to a through m, and 9 through 5 to 0 through 4, respectively. The letters A through M, a through m, and the digits 0 through 4 are effectively unchanged (by changing each of them twice).
without sequences , can we put everything together , so that i will achieve what i want or any other suggestion

Last edited by Rajesh_us; 01-16-2014 at 04:36 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check position of end of line for some specific lines

-------------------------------------------------------------------------------- Have to check in a file that the lines starting with 620 and 705 are ending at same posiotin. 82012345 62023232323 70523949558 62023255454 9999 In the above lines, i have to check the lines starting... (1 Reply)
Discussion started by: senthil_is
1 Replies

2. Shell Programming and Scripting

Deleting Characters at specific position in a line if the line is certain length

I've got a file that would have lines similar to: 12345678 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 23456781 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 34567812 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 45678123 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 xx.00... (10 Replies)
Discussion started by: Cailet
10 Replies

3. Shell Programming and Scripting

search a line and insert string into specific at position

Hi, guys. I have one question: How can I search for a line with certain string in it and then insert a string into this line? For example: There is a file called shadow, the contents of it are below: ************************** ... yuanz:VIRADxMsadfDF/Q:0:0:50:7:::... (9 Replies)
Discussion started by: daikeyang
9 Replies

4. Shell Programming and Scripting

Search in specific position and print the whole line

I have two files abc.dat and sant.dat (Big file 60k rows) for every line's 1,4 of abc.dat need to seach if this is present on 28,4 of sant.dat every line. if its present the output needs to go to bde.dat Example: contents abc.dat aaaa bbbb cccc dddd contents sant.dat this is... (4 Replies)
Discussion started by: ssantoshss
4 Replies

5. Shell Programming and Scripting

Find the position of a pattern on a line from a csv file

hello I'm doing a unix program and i'm using many file csv.in each csv file the colums are separated by ";" I would like to know the position of a pattern. For example for a line yyyy, bbbb, cccc; ddddd;eeee. I will like for example by finding the position of the pattern "cccc" and the response is... (6 Replies)
Discussion started by: papis
6 Replies

6. Shell Programming and Scripting

Printing characters at specific position in line

Hi, I am trying to get an output like : +----------------------------------+ ----------- + + some variable substitution + some text + Is there a way I can specify in printf (in ksh) the particular position I want to print a character, and also repeat a character from... (1 Reply)
Discussion started by: neil.k
1 Replies

7. Shell Programming and Scripting

How to concatene files and put each line of files on a specific position ?

Hi, I have some files that i want to concatene and put each of lines of this files on a specific position : File1 AAAAAAA BBBBBBB CCCCCCC File2 DDDDDDD EEEEEEE FFFFFFF File3 GGGGGG HHHHHH IIIIII New file (6 Replies)
Discussion started by: apippo70
6 Replies

8. Shell Programming and Scripting

Find and replace with 0 for characters in a specific position

Need command for position based replace: I need a command to replace with 0 for characters in the positions 11 to 20 to all the lines starts with 6 in a file. For example the file ABC.txt has: abcdefghijklmnopqrstuvwxyz 6abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz... (4 Replies)
Discussion started by: thangabalu
4 Replies

9. Shell Programming and Scripting

Remove line break at specific position

Hi, I need to remove line breaks from a file, but only the ones at specific position. Input file: this is ok this line is divided at posit ion 30. The same as this one, also position 30 the rest of lines are ok with different lengths The longest ones are always s plitted at same... (15 Replies)
Discussion started by: qranumo
15 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
mark(1mh)																 mark(1mh)

Name
       mark - mark messages

Syntax
       mark [ +folder ] [ msgs ] [ options ]

Description
       Use the command to assign a name to a sequence of messages within the current folder.

       A  sequence  is	a  number of messages that are grouped together under a name.  You can then use that name with any MH command instead of a
       message number, to perform the command on all the messages in the sequence.  You can still continue to handle  messages	individually  when
       they belong to a sequence, just as you did before.  Sequences are specific to a particular folder.  You can use the same name for sequences
       in different folders without causing problems.

       By default, operates on the sequences in the current folder.  You can specify another folder by using the +folder argument.

       When you create a sequence using the ordering of messages within the folder remains unchanged.  So if messages 3, 7 and 9 are put into  the
       sequence,  they	are  still numbered as messages 3, 7 and 9 when you use to list the contents of the folder.  The command does not show you
       what sequences messages belong to; you must use to find this information.

       The command is used only to modify sequences, not messages.  If you delete a message from a sequence using it remains in the folder.   How-
       ever, when a message is deleted or moved from a folder (for example, using or it is removed from all the sequences in that folder.

Options
       -add	 Adds  messages  to sequences.	The command takes the messages specified by the msgs argument, and adds them to the sequence named
		 by using the -sequence name option.  If no msgs argument is given, the current message is added to the sequence.  This option can
		 also be used in conjunction with the -zero option.

		 This  option cannot be used in conjunction with the -delete or -list options.	If you attempt to use two or more of these options
		 together, takes the last occurrence of any of them, and ignores any previous occurrences.

       -delete	 Deletes messages from sequences.  The command removes the messages specified by the msgs argument from the named  sequences.	As
		 with  -add,  the  sequences  are specified using the -sequence name option.  If no msgs argument is given, the current message is
		 removed from the named sequences.  This option can also be used in conjunction with the -zero option.

		 This option cannot be used in conjunction with the -add or -list options.  If you attempt to use two or  more	of  these  options
		 together, takes the last occurrence of any of them, and ignores any previous occurrences.

       -help	 Prints a list of the valid options to this command.

       -list	 Lists	the  sequences	defined for the current folder and the messages associated with those sequences.  If you wish to list only
		 particular sequences in a folder, you can specify them by using the -sequence name option.  If you do not use this option,  lists
		 all the sequences in the current folder.  You can also list sequences in another folder by using the +folder argument.

		 This  option  cannot be used in conjunction with the -add or -delete options.	If you attempt to use two or more of these options
		 together, takes the last occurrence of any of them, and ignores any previous occurrences.

		 The command automatically lists the sequences in the folder unless you use the -add or -delete options, or unless you give a msgs
		 argument.

       -public
       -nopublic Indicates  that  the sequence being created should be made readable for other MH users.  When you use the -add option to create a
		 sequence, the -public option makes the sequence public, that is, readable to other MH users.  By contrast, the  -nopublic  option
		 indicates that the sequence should be private, or exclusive to your own MH environment.

       -sequence name...
		 Specifies  the  sequence(s)  you  wish  to  list or modify.  You use this option in conjunction with the -add, -delete, and -list
		 options, to name the sequences you wish to add messages to, delete messages from, or list.  You can name more than  one  sequence
		 by listing the names with a space separating them; you do not need to repeat -sequence before each sequence name.

       -zero
       -nozero	 Modifies the behavior of the -add and -delete options.

		 If  you use the -zero option with -add, all messages are removed from the named sequence before the new messages are added to it.
		 This means that the sequence contains only the new messages that you have just added.	The -nozero option  simply  adds  the  new
		 messages to the existing sequence, without deleting any of the messages already in the sequence.  This is the default behavior.

		 If you use -zero with -delete, all of the messages in the folder are added to the named sequence, and then the messages you spec-
		 ify are deleted from the sequence.  This means that the sequence contains all the messages in the folder except  those  that  you
		 have  named.	The  -nozero option simply removes the messages you specify from the sequence, leaving the rest of the contents of
		 the sequence intact.  This is the default behavior.

       The defaults for this command are:

	      +folder defaults to the current folder
	      msgs defaults to the current message (or all messages if -list is specified)
	      -add if a msgs argument is specified, -list otherwise
	      -nopublic if the folder is read-only, -public otherwise
	      -nozero

Restrictions
       MH allows a maximum of ten sequences in any folder.

       The names of sequences must consist entirely of alphabetic or numeric characters, and must begin with an alphabetic character.  Punctuation
       is not allowed.	In addition, certain names are reserved for use by MH.	These include first, next, prev, and cur.

Examples
       The first example shows how lists all the sequences in a named folder:
       % mark
       cur: 20
       Admail: 1 5 9-12
       test: 3-7
       This output is identical to that produced by using the -list option.

       The next example creates a sequence called odd, containing the first five odd-numbered messages:
       % mark -add -sequence odd 1 3 5 7 9
       % mark
       cur: 20
       Admail: 1 5 9-12
       odd: 1 3 5 7 9
       test: 3-7

       The next example deletes message 3 from the sequences test and odd:
       % mark -delete -sequence test odd 3
       % mark
       cur: 20
       Admail: 1 5 9-12
       odd: 1 5 7 9
       test: 4-7

       The  final  example illustrates how the -zero option works with -add.  All messages are first removed from the sequence test, and then mes-
       sages 1 to 3 are added.	The result is that test contains only messages 1 to 3:
       % mark -add -zero -sequence test 1-3
       % mark
       cur: 20
       Admail: 1 5 9-12
       odd: 1 5 7 9
       test: 1-3

Profile Components
       Path:   To determine your Mail directory

Files
       The user profile.

See Also
       folder(1mh), pick(1mh), sortm(1mh)

																	 mark(1mh)
All times are GMT -4. The time now is 02:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy