View previous topic :: View next topic
|
Author |
Message |
pritamkarwa
New User
Joined: 04 May 2023 Posts: 5 Location: India
|
|
|
|
Hi
i have a input file with few numbers on each line, i want to add 1 to all of them and write to output file
input
1
5
6
8
10
150
200
output
2
6
7
9
11
151
201
can i achieve this using sort? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Please use code tags when presenting code/data to the forum!
Yes, it's possible to do that. As this is primary a help forum, and not a write-the-code-for-me, show what you have attempted to achieve what's requested. |
|
Back to top |
|
|
pritamkarwa
New User
Joined: 04 May 2023 Posts: 5 Location: India
|
|
|
|
i tried this but it is doing 1 as 1001 but 283 as 284.
Code: |
OPTION COPY
INREC BUILD=(1,4,ZD,ADD,+1,EDIT=(TTTT),X)
END
|
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Give this a try:
Code: |
INREC BUILD=(1,4,SFF,ADD,+1,EDIT=(STTT),SIGNS=(+,-)) |
Input:
Code: |
-2
5
6
8
10
150
200 |
Output:
Code: |
-001
+006
+007
+009
+011
+151
+201 |
More info in the DFSORT manual, Appendix C. Data format descriptions |
|
Back to top |
|
|
|