Sponsored Content
Top Forums Shell Programming and Scripting Hint needed for incrementing numbers Post 302934331 by RudiC on Friday 6th of February 2015 08:01:40 AM
Old 02-06-2015
This might be a Useful Use Of Cat:
Code:
cat -n file | while read NR REST; do echo "fruit etc. $REST is in basket$(((NR+1)/2))"; done

These 2 Users Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

incrementing a for loop

I have, LIST="a b c d e" for word in $LIST do echo $word done would give me a b c d e With the first iteration of the for loop, I get "a" as the result. Is it possible that I get both "a" and "b" in only the first iteration. In the next iteration I get "c" and "d" and so on.... (2 Replies)
Discussion started by: run_time_error
2 Replies

2. Programming

hint on ansi c

I am a student. And need help on following program. I want to make a c program. I have to scan a sentence and I have to interchange a word from that sentence. Example: Scan the sentence is " Drilling machine and Milling machine " . Replace the word "machine" by "operation". And output should... (2 Replies)
Discussion started by: dhaval chevli
2 Replies

3. UNIX for Dummies Questions & Answers

SSLSessionCache hint

Folks; I just installed Apache2.2.6 on Solaris 10 & when i try to start it, i got this message in the error.log file: Init: Session Cache is not configured Any help? Thanks in advance (2 Replies)
Discussion started by: moe2266
2 Replies

4. Post Here to Contact Site Administrators and Moderators

No. post not incrementing

Hi Admin, i just noticed that when I do postings, the number does not increment. eg : Post A -Total Posts 312 Post B - Total Posts 312 Post C - Total Posts 313 Post D - Total Posts 313 Why is this so? Can you kindly check this out? Thank you. (5 Replies)
Discussion started by: incredible
5 Replies

5. Shell Programming and Scripting

Incrementing in while loop

echo "Enter Starting id:" echo "" read rvst_strt_idxx echo "" echo "Enter Closing id:" echo "" read rvst_clsn_idxx FIELD1=$rvst_strt_idxx FIELD2="USER" FIELD3="TEST" FIELD4="12345" FIELD5="00000" echo "" echo "INSERT INTO TABLE( FIELD1, FIELD2, FIELD3, FIELD4, ... (7 Replies)
Discussion started by: ultimatix
7 Replies

6. Programming

incrementing variables in C++

Hello, what is the result of the below, and how does it work? int i = 5; cout << i++ * ++i << endl; cout << i << endl; (12 Replies)
Discussion started by: milhan
12 Replies

7. Windows & DOS: Issues & Discussions

Give Win Explorer a hint to graphics files w/o extensions?

All: Benjamin Fournier wrote a plug-in for the graphics application PhotoFiltre Studio that inspired me, since I also happen to use the XnView Shell Extension and have seen what it can do, to look into the possibility of getting Windows XP Pro SP3's Explorer file navigator to "hazard a guess at"... (1 Reply)
Discussion started by: SilversleevesX
1 Replies

8. Shell Programming and Scripting

Change numbers in a file, incrementing them

Hello, Here's a file of mine: key1:431 key2:159 key3:998 I need to change these keys to something bigger - and I actually need to shift them all by a range of 3. The output would be: key1:434 key2:162 key3:1001 I can't find the propper sed/awk line that would alter all my... (4 Replies)
Discussion started by: fzd
4 Replies

9. Shell Programming and Scripting

help needed to put instance numbers

Hi All I need help am having a source file as below emp dept class subclass region country division first i need to get line count and i need to divide by 3 it is an parameter passing value number of lines 7 (8 Replies)
Discussion started by: ragu.selvaraj
8 Replies
Dancer::Plugin::REST(3pm)				User Contributed Perl Documentation				 Dancer::Plugin::REST(3pm)

NAME
Dancer::Plugin::REST - A plugin for writing RESTful apps with Dancer SYNOPSYS
package MyWebService; use Dancer; use Dancer::Plugin::REST; prepare_serializer_for_format; get '/user/:id.:format' => sub { User->find(params->{id}); }; # curl http://mywebservice/user/42.json { "id": 42, "name": "John Foo", email: "john.foo@example.com"} # curl http://mywebservice/user/42.yml -- id: 42 name: "John Foo" email: "john.foo@example.com" DESCRIPTION
This plugin helps you write a RESTful webservice with Dancer. KEYWORDS
prepare_serializer_for_format When this pragma is used, a before filter is set by the plugin to automatically change the serializer when a format is detected in the URI. That means that each route you define with a :format token will trigger a serializer definition, if the format is known. This lets you define all the REST actions you like as regular Dancer route handlers, without explicitly handling the outgoing data format. resource This keyword lets you declare a resource your application will handle. resource user => get => sub { # return user where id = params->{id} }, create => sub { # create a new user with params->{user} }, delete => sub { # delete user where id = params->{id} }, update => sub { # update user with params->{user} }; # this defines the following routes: # GET /user/:id # GET /user/:id.:format # POST /user # POST /user.:format # DELETE /user/:id # DELETE /user/:id.:format # PUT /user/:id # PUT /user/:id.:format helpers Some helpers are available. This helper will set an appropriate HTTP status for you. status_ok status_ok({users => {...}}); Set the HTTP status to 200 status_created status_created({users => {...}}); Set the HTTP status to 201 status_accepted status_accepted({users => {...}}); Set the HTTP status to 202 status_bad_request status_bad_request("user foo can't be found"); Set the HTTP status to 400. This function as for argument a scalar that will be used under the key error. status_not_found status_not_found("users doesn't exists"); Set the HTTP status to 404. This function as for argument a scalar that will be used under the key error. LICENCE
This module is released under the same terms as Perl itself. AUTHORS
This module has been written by Alexis Sukrieh "<sukria@sukria.net>" and Franck Cuny. SEE ALSO
Dancer <http://en.wikipedia.org/wiki/Representational_State_Transfer> perl v5.14.2 2011-11-01 Dancer::Plugin::REST(3pm)
All times are GMT -4. The time now is 03:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy