Sequence between 001010 and 001050


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sequence between 001010 and 001050
# 1  
Old 02-03-2010
Sequence between 001010 and 001050

Hi,
i want a script that can generate all the sequence of numbers between 001010 and 001050.
result should be like
001010
001011
001012
.
.
.
001050

Thanks
# 2  
Old 02-03-2010
Code:
nawk 'BEGIN { for(i=1010;i<=1050;i++) printf("%06d\n", i) ; exit }'

Replace nawk by awk if not on Solaris.
# 3  
Old 02-03-2010
try (bash shell):

Code:
echo {001010..001050}

if want newline,

Code:
echo {001010..001050} | tr " " "\n"


Last edited by clx; 02-03-2010 at 07:59 AM.. Reason: added tr part
# 4  
Old 02-03-2010
it worked.
Thanks

---------- Post updated at 01:11 PM ---------- Previous update was at 12:52 PM ----------

hoew about if i want to double quote them
i tried using "\042" but i could get the desired results
i want it to look like
"001010";
.
.
.
"001050";
# 5  
Old 02-03-2010
Code:
echo {001010..001050} | sed -e 's/^/"/g' -e 's/$/"/g' -e 's/ /"\
"/g'

or with jlliagre's solution:

Code:
awk 'BEGIN { for(i=1010;i<=1050;i++) printf("\"%06d\"\n", i) ; exit }'

# 6  
Old 02-03-2010
Code:
[n]awk 'BEGIN { for(i=1010;i<=1050;i++) printf("\"%06d\";\n", i) ; exit }'

# 7  
Old 02-03-2010
try this

Code:
 
seq -f "\"%06g\"" 001010 001050

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sequence extraction

i want to extract specific region of interest from big file. i have only start position, end position and seq id, see my query is: I have file1 is this >GL3482.1 GAACTTGAGATCCGGGGA GCAGTGGATCTCCACCAG CGGCCAGAACTGGTGCAC CTCCAGGCCAGCCTCGTC CTGCGTGTC >GL3550.1... (14 Replies)
Discussion started by: harpreetmanku04
14 Replies

2. Red Hat

Rm -rf * sequence

If I run rm -rf * command under one parent directory. /data > rm -rf * Is there anyway to know which files will be deleted first ? Start using code tags please, ty. (2 Replies)
Discussion started by: sameermohite
2 Replies

3. Shell Programming and Scripting

Sequence generator

Thanks Guys This really helped (5 Replies)
Discussion started by: robert89
5 Replies

4. 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

5. Shell Programming and Scripting

Check Sequence

* Expiry DATE: * Address1: Address2: Address3: Address4: Address5: * PO_ref_number: aadad HolderId_1: HolderId_2: HolderId_3: HolderId_4: * adad: 00000 ada: 00000 adad: RANDOM adad: RANDOM ****************************** (4 Replies)
Discussion started by: arunshankar.c
4 Replies

6. Shell Programming and Scripting

ls all files in sequence. How to?

Hi, all: Newbie questions: For example, if I have 6 files, respectively named as: How to "ls" all files in sequence of two ways? 1) The first way is according to the sequence of the natural number. Say, the same sequence as shown as they are given. 2) The second way is default... (2 Replies)
Discussion started by: jiapei100
2 Replies

7. Shell Programming and Scripting

ID generation in sequence

i have an xml tag. The value for the tag should be iterated through out the xml document. eg: <data><id><id><name>a</name><addr>aaa</addr><phnumb>3456</phnumb><state>ca</state><city>ny</city></data>... (6 Replies)
Discussion started by: Sgiri1
6 Replies

8. UNIX for Dummies Questions & Answers

bootup sequence

What is the boot up sequence in UNIX? (2 Replies)
Discussion started by: karthi_g
2 Replies

9. Shell Programming and Scripting

To grep in sequence

Hi, I have a log file containg records in sequence <CRMSUB:MSIN=2200380,BSNBC=TELEPHON-7553&TS21-7716553&TS22-7716553,NDC=70,MSCAT=ORDINSUB,SUBRES=ONAOFPLM,ACCSUB=BSS,NUMTYP=SINGLE; <ENTROPRSERV:MSIN=226380,OPRSERV=OCSI-PPSMOC-ACT-DACT&TCSI-PPSMTC-ACT-DACT&UCSI-USSD;... (17 Replies)
Discussion started by: helplineinc
17 Replies

10. Shell Programming and Scripting

escape sequence for $

Hi all, I have a requirement where the variable name starts with $, like $Amd=/home/student/test/ How to work wit it? can some one help me, am in gr8 confusion:confused: (5 Replies)
Discussion started by: shreekrishnagd
5 Replies
Login or Register to Ask a Question