General :: Tail Command Syntax To Print A Sequence Of Line ?
Dec 21, 2010How to print a sequence of line say line number 10 to 20 of a 50 line file ?
View 6 RepliesHow to print a sequence of line say line number 10 to 20 of a 50 line file ?
View 6 RepliesI want to tail the latest log file in one command line. I dont know what command/option to use for the same.
View 5 Replies View RelatedI am repeatedly getting error:
I need to pass the value of:
I am using #!/bin/bash
This command works on shell without any issue.
I'd like to print only few groups from text matching a regex. How can I do that in the Linux command line?
What other tools for text processing are there in Linux?
CUPS was not originally installed on my server, I have installed it but cannot print to my network printer. On my laptop, I can... they are both running the same version of Debian. What could be missing?
Here are some details...
I have two computers running the same version of Debian. One is a server with no GUI and the other is my laptop with GDM installed. My laptop (which prints with no problem) is connected via Wifi. My server is connected directly to the router via Ethernet. I cannot print from the server.
The printer is a Canon Pixma MP495 that connects to the router via Wifi. I have downloaded drivers for the printer from [url] and installed them successfully using dpkg on both computers.
Right now I have a regular text file that I am using for a test page. To print from my laptop (with success) I type:
Code:
This does not work from the server. What could I be missing?
lpq run on server:
Code:
lpinfo readout:
Code:
I am running a script with nohup and this generates a lot of logs.
In order to view the log I use tail -f nohup.out
The problem is that the info supplied by this command is not always the latest//sometimes I need to use the command again order to view the latest info added to the nohup.out file.
I am trying to find a way to print PDFs from the command line. I was using "cups-pdf', but I want to be able to specify the output folder from the command line. Is there a way to do this? I guess what I am trying to do is the Gnome "Print to file" option in the terminal so I can easily print off a batch of file to whatever directory I wanted.
View 4 Replies View RelatedI am using an awk command to print a line from a cvs file.the awk command includes an if statement that filter the output-lets say i want to print all the lines that the price field is greater than 30.i have it working when i put the parameters myself.. but when i try to send them with vars it wont work..i am sending the sign of the if statement - can only be: == , < , >it looks like this:
cat file.csv | awk -v sign=">" -v field="2000" '{if($3 sign field) printf "%-12s%-12s%-12s%-12s
",$1,$2,$3,$4}' FS=,
the bold part is the problem , because when i put the sign parameter myself t works great.. i guess its a chars issue but i cant spot it
how to use multiple linux cut comman to display on same line ?
e.g ls -il | cut -f6 d:
ls - il cut -f9 -d:
The linux script output is
filename
123
How to use cut to display on same line ?
I work at The University of Alabama as a sysadmin on various HPC resources and also provide support for faculty using Unix systems. I've run into one problem that is affecting two different desktop systems running CentOS 5.3.oth of these systems have the latest updates. These machines have standard network-attached printers. One is an HP LaserJet 3250 and the other is a model that is pretty close to that one.Previously these users were able to print from graphical applications such as Firefox, but now when the print dialog is opened on ANY graphical application, it causes a hard freeze on that particular app.Printing from the commandline via `lpr` gives no issues and test pages from the Printer Admin interface also succeed.This problem has me stumped, so I'm looking for any insight as to what could have changed. I do not know what changed between the time when the printers worked graphically and when they stopped, but the users assure that they have changed no settings. The only thing I can suspect is a rogue update since this is affecting separate users on separate machines with separate printers.
View 4 Replies View RelatedI have a requirement to print images (two to be precise) from the command line of a given size and without losing too much quality.
So, I may have two images, a.jpg and b.jpg which may be 4x4" and 6x4" respectively (the sizes may vary). I need to be able to print both these on a single sheet of paper (one under the other) at a given size for each - so a may be 2x2" and b may be 3x2" - the aspect ratio will always be maintained (or as near as possible!)
I am currently doing this a very messy way (because I don't know any other way!!) - basically I am converting the picture to a given size using a set density using convert and then concatenating the two using montage.
Here is part of my script:
Code:
Don't worry too much about the case statement at the end - that is just to be able to select to print either A, B or A and B.
The issue with this is that is doesn't work great if the aspect ratio is not maintained perfectly and also, it loses quite a lot of quality on the print.
I have a very old windows app which I wrote years back in VB (o dear! ) which does the same thing and the quality is fine (I am running it through wine). I want it to be command line though because I want to run it as part of other scripts etc.
I've written a script to parse a file and print each line that ends with matching pattern, if the next line is blank. The pattern lines are the result of md5sum $i|sed 's/path///g' so that only md5 and filename appear. Here's what I'm using.
Quote:
for fline in `sed -n '/.*.ext$/p' file1`
do
if [ "`sed -n -e '/'"$fline"'/ {n; p;}' file1`" == "" ]
then
echo ""$fline" has no info" >>file2
fi
done
[Code]....
I want to print the line number with the pattern of the line on a same line using multi-patterns in sed. But i don't know how to do it. For example, I have a file
abc
def
ghi
I want to print
1 abc
2 def
3 ghi
I am trying to write a program in C which compares two files and prints the line that is equal.
Here file1.txt has
and file2.txt has
Note: file2.txt consist of only a single string where as file2.txt has multiple lines. Actually im comparing two files with md5sum values.
Here is the code but it compares only first line of files..but it should compare the whole file1..and sorry iam a beginner in C can any1 sujest some modification to this code so that..it can compare file2 with entire file1
Quote:
I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.
[Code]....
One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?
Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.
I have a program I use, rrdtool. I need to modify a ds value on every file at the same time. However, using a wildcard (*) to try this operation of all files does not work and instead only updates one file.
Here is the command syntax:
rrdtool tune <file> --maximum traffic_in:100000000000 && rrdtool tune <file> --maximum traffic_out:100000000000
So, how can I do this on every file in the directory?
I'm currently studying for my Linux+ test and I'm getting conflicting information regarding the rm -rf command. Yes, I know this a dangerous command, but my question is in regard to how the command functions. In one book I'm studying it says that rm -rf / home/myfolder (there's a space in there) will delete the entire root directory because there is a space between the root and home directory. It says that if there is a spacing such as this, it will ignore anything after the space, so in this case, it would delete the root directory and stop, not that there would be anything left anyway. Then in another book I have, it says that if you did a rm -rf folderName / (with the intention of adding the trailing slash to indicate it is a directory and not a folder) it will delete everything in folderName (assuming it's a child directory of your pwd) and then CONTINUE on and delete the root directory. Now, those two statements contradict each other. When you remove a directory, does the command line ignore anything after a space or not?
View 1 Replies View RelatedI am reading "A Byte of Python" and this is the 2nd time I've completely been confused about something:"What if you wanted to specify a two-line string? One way is to use a triple-quoted string asshown previously or you can use an escape sequence for the newline character - toindicate the start of a new line. An example is This is the first lineThis is thesecond line. Another useful escape sequence to know is the tab - There are many moreescape sequences but I have mentioned only the most useful ones here."In python:>>> "This is the first lineThis is the second"'This is the first lineThis is the second'>>>
View 1 Replies View RelatedI'd like show a certain line or lines of a file with context, kind of like a unified diff, on the command line in Linux:
$ (something) -l 154 stuff.py
150: def foo(bar):
151: """
[code]....
How can I print Linux command line history without including the line numbers? I want to send it all to a text file like this:history >> history.txt
View 1 Replies View RelatedI have a perl/python interpreter available on the system so really as long as the script would run on a standard linux build I'll be happy.So I don't know how to program a script that would find the unique key (which if needed, can be easily stripped out and put into a separate file) and then print out the data below it without going into the other lines.
View 4 Replies View RelatedWhen ever i open vim, i get the error that the following error: E484: Can't open file/abcd/configFiles/vim/syntax/syntax.vim There was a .vimrc file in my home folder that i have removed.
Still i keep getting the same error. Presently in my home folder there is no .gvimrc or .vimrc file.
But still i keep getting the same error. I am not too sure where this file is mentioned.
Background info: The SHELL has been changed from tcsh to bash Earlier i had created a .vimrc file in tcsh, i have removed the .vimrc in bash SHELL.
i've gotten my fedora 12 to the point where i can run python3 scripts from command line and can call up python 2.6.2 idle with the command 'idle' from command line. what command will call up python3 (3.1.2 to be exact) idle?
View 5 Replies View RelatedI know my way around MS Windows much better, but I just don't feel right trying to program something for Android on a Microsoft operating system. I am interested in Android programming so I followed the instructions on [URL] to install the environment on my computer...
I just installed the JDK, SDK, Eclipse successfully (or I assume):
* When I get to Step 4 where I'm supposed to run 'android' it will not run. I get the error message "android: command not found" (I am definitely in the right directory).
** When I double-click it in nautilus, it opens up in gedit. I can set the permissions in nautilus (through the properties - Allow executing file as a program) and get it to work,
My system:
Intel i7
Ubuntu 10.10 Maverick Meerkat
android-sdk-linux-x86
eclipse 3.6.2
I installed the Berkeley DB on the Ubuntu server and tried to access the dbxml from the command line and it returns command not found
path/to/dir/dbxml-2.5.16/install/bin$dbxml
-bash" dbxml: command not found
Can someone point me in the right direction
I am creating a script to sync my important documents between two system. I want my script to generate a log file for the last action. can you suggest me a way to achieve this.Question: If I execute the rsync command with -v flag, it will print a lot of messages on the console. Is there any way. So, I can redirect these logs to a file?
View 4 Replies View RelatedI am looking for a way to print the timestamp of a directory using find command. I can do that for a file, but for a directory, it is printing the contents of the directory as well. Lets say there is a directory called doc, and there are more than one occurrences of that directory.
find . -name "doc" -type d -exec ls -l {} ;
This is printing the contents of all the files under doc directory as well.
Okay, first off I'm no hotshot programmer (and actually lack much familiarity with shell scripting) so apologies in advance if this problem is so trivial as to be irritating.
What I'm trying to do is drop the following command from either a shell script or a perl program. However, while it executes fine and does what it's supposed to when entered from the command line, I can't get it to work as a system call.
Here's the line:
Code:
When I drop it from a shell script like this:
Code:
I get the following:
Code:
If I try escaping the ()s with or ', I get this:
Code:
I've tried a bunch of other stuff to get it working (deleting the ()s, spacing them differently, etc) and looked around online for a solution, but I can't find anything that works.
I tried a shell script directly only after anything I tried to drop it from perl with `` or system() failed with the same errors.
I have compiled both gocr and subtitleripper from [URL] and I am running into a problem with one of the scripts run from subtitleripper: pgm2txt. The error is:
Code:
andrew@skamandros~/Desktop/Labyrinth/subtitles$ pgm2txt -f en fauno
/usr/bin/pgm2txt: line 165: unexpected EOF while looking for matching `"'
/usr/bin/pgm2txt: line 179: syntax error: unexpected end of file
Support for this program is not available and development has ceased a while ago so I have had a look at the script itself and I cannot see the error in syntax.
how do you write the ASCII character #27 in the vim command line?
View 6 Replies View Related