ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
But how to put this into a loop I am not sure. Also still don't really know what you mean by $N. Do you mean the nth ($N) character I split?
How do you detect the end footer? Look ahead by one character and see if it is a $?
By $N I mean $1, $2, $3, etc you've already used.
I do not understand why you need a loop - every line which comes you split into chunks using all those $N variables. You are already doing this, don't you ?
Sorry, but being able to match a character literally is a very basic knowledge, and the tutorial I suggested to read really has this info - somewhere in the beginning.
Your $header, $body, $foot code doesn't make sense to me. Do you understand how the $N variables work ? If not, it's described in the already suggested tutorial.
I do not understand why you need a loop - every line which comes you split into chunks using all those $N variables. You are already doing this, don't you ?
Sorry, but being able to match a character literally is a very basic knowledge, and the tutorial I suggested to read really has this info - somewhere in the beginning.
Your $header, $body, $foot code doesn't make sense to me. Do you understand how the $N variables work ? If not, it's described in the already suggested tutorial.
It's not every line though - it's only a single line.
I can do it by having 80+ $N variables, yes. That works!
Can I redirect the output to a file with that?
It works if I already have the barcode scanned into a file, I can just use the input and output parameters but what if i scan the barcode directly, it takes the input fine and outputs the fine also, but only to STDOUT
I am not sure if you are talking to me or Sergei but in mine you can either redirect on the command line or at the print points in the code.
eg. the command line would look like:
Code:
./script input_file > output_file
Yes thanks, I got tht to work. But if i just run the script, it waits for input. I wanted to just scan the barcode with the handheld scanner and have it either prompt for a file name or let me do something like
The script is waiting for a filename as it uses this to run its changes over, so yes without one it will wait.
When you run the barcode scanner normally, how does it pick the file to save into?
The script is waiting for a filename as it uses this to run its changes over, so yes without one it will wait.
When you run the barcode scanner normally, how does it pick the file to save into?
It just outputs like a keyboard, it doesn't pick the file at all.
Ok, we are missing each other here. If you were at your desktop with no applications open and started typing, generally nothing
would happen unless you hit specific key combinations.
However, if you had a terminal or editor open, then what you typed would appear in those applications.
So, if I plug your scanner into the computer and scan a barcode, would my data go anywhere or does it also require the terminal/editor to be opened
first? Or does it simply send the data straight to a file?
Ok, we are missing each other here. If you were at your desktop with no applications open and started typing, generally nothing
would happen unless you hit specific key combinations.
However, if you had a terminal or editor open, then what you typed would appear in those applications.
So, if I plug your scanner into the computer and scan a barcode, would my data go anywhere or does it also require the terminal/editor to be opened
first? Or does it simply send the data straight to a file?
Well I would open notepad/kwrite and it would appear directly in kwrite/notepad just as if you were typing. Likewise if you had cmd/shell open it would appear at the command prompt as if you were typing a command. Data won't go to a file unless you press save or pipe it manually into an echo command e.g.
type echo "
scan barcode
type " >> file
I have been busy, but I do have an option although not necessarily very automated.
If you type the following:
Code:
./script > output_file
This will wait for input. So now you can scan using the reader and this will be entered.
If you hit enter after last scan and then the key combination - ctrl+d
This will now pass whatever has been scanned into the script and then into the file.
Sorry I cannot think of a more automated way. Hopefully someone else will see and suggest something, but for now this should work.
I want to use this feature to generate PDF417 ad Aztec barcode without generating a PDF file. (Like saving it to a file (PMG. SVG, etc) I looked at the included files to see if I can find the code I need, but I didn't find anything.
On the website, akk the exemples are based on the fact that people want a PDF file... I jsut want the image
Any suggestion? I don't want to pay 400$ for a barcode.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.