Sponsored Content
Full Discussion: Adding sequence to the file
Top Forums Shell Programming and Scripting Adding sequence to the file Post 302424967 by smee on Wednesday 26th of May 2010 08:47:18 PM
Old 05-26-2010
Adding sequence to the file

How do I add the sequence number to the file? I have a file seperated by commas.
appusage,243,jsdgh,798
appusage,876,0989,900
.
.
appusage,82374,ajfgdh,9284

The output would be as below
1,appusage,243,jsdgh,798
2,appusage,876,0989,900
.
.
100,appusage,876,0989,900
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding a sequence string to a file

I have a pipe delimited file I need to add a sequence number to in the third field. The record fields will be variable length, so I have to parse for the second pipe. Another requirement is that the sequence number must be unique to all records in the file and subsequent files created, so the... (5 Replies)
Discussion started by: MrPeabody
5 Replies

2. Shell Programming and Scripting

Adding a sequence number within a file

Can someone please help. I need to add a sequence number to the start of each line of a file. It needs to be 6 characters long. ie 000001 next line starts 000002 etc. (4 Replies)
Discussion started by: Dolph
4 Replies

3. Shell Programming and Scripting

How to split a file with adding sequence number and extension.

I have a file name -HRCFTSIN05PLA1602100430444444 my requirement is to split the file in 10000 count each file and to add sequence number.rch at the end of each file. output should be in this format HRCFTSIN05PLA160210043044444401.rch HRCFTSIN05PLA160210043044444402.rch... (4 Replies)
Discussion started by: abhigrkist
4 Replies

4. Shell Programming and Scripting

Adding new lines to a file + adding suffix to a pattern

I need some help with adding lines to file and substitute a pattern. Ok I have a file: #cat names.txt name: John Doe stationed: 1 name: Michael Sweets stationed: 41 . . . And would like to change it to: name: John Doe employed permanently stationed: 1-office (7 Replies)
Discussion started by: hemo21
7 Replies

5. UNIX for Dummies Questions & Answers

Adding Sequence Number to file

Hi All, I need to create a script which checks for a particular file for eg.kumar1.txt. If kumar1.txt is already exist the script should increment the file name as kumar2.txt and so on. Please Advise. Thanks & Regards, Kumar66 (2 Replies)
Discussion started by: kumar66
2 Replies

6. UNIX for Dummies Questions & Answers

Adding a running sequence number while appending 2 files

Hi, I have to append 2 files and while appending i need to add a running sequence number (counter ) for each line at the first column. For e.g. If file x contains details as below. Tom Dick Harry Charlie and file y contains Boston Newyork LA Toledo Then the new file should... (1 Reply)
Discussion started by: kalyansid
1 Replies

7. Shell Programming and Scripting

Going places with a Dolphin (adding to xml in sequence)

Hi all, I hope someone can help me write a script that: Reads the xml file which holds Dolphins "Places" in KDE. If a specific tag is not there, it should create a set for it, in order. so this little file lives in ~/.kde/share/apps/kfileplaces/bookmark.xml Here is my example. <?xml... (3 Replies)
Discussion started by: CtrlKey
3 Replies

8. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

9. Shell Programming and Scripting

Need Help in adding sequence number to a file

Hi All , I have a file which contains data(comma separated) in below format : 500,Sourav ,kolkata ,8745775020,700091 505,ram,delhi ,9875645874,600032 510 ,madhu ,mumbai ,5698756430 ,500042 515 ,ramesh ,blore ,8769045601 ,400092 I want to add unique sequence number at the start of each... (7 Replies)
Discussion started by: STCET22
7 Replies

10. UNIX for Beginners Questions & Answers

Adding to an array in an external file, and adding elements to it.

I have an array in an external file, "array.txt", which contains: char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)
Discussion started by: ignatius
29 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 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy