Programming :: Command To Run Another One On Few Lines

Jul 23, 2010

Is there a command which can be used to run some other command on a few lines from a file or an o/p of some file. (the kind of role that -exec option does for the find command). (I have solved the purpose using a bash loop but would like to know if there exists a command).

View 4 Replies


ADVERTISEMENT

Programming :: Using Variable To Store Command Lines In A Pipeline?

Jan 28, 2010

Was trying to write a shell script that has if conditional statements to decide different arguments for a command.Basically:

Code:
if [ "$1" = 1 ]
then

[code]...

View 6 Replies View Related

Programming :: Remove Lines And Parts Of Lines From Python Strings?

Nov 24, 2009

How do you remove parts of strings using python? Such as, if I have something like:

Code:
erme1 sdifskenklsd
erme2 sdfjksliel

[code]....

View 3 Replies View Related

Software :: Command To Get History Command Lines And Time In SUSE?

Jun 23, 2009

I have to trace back what command and when it is used for the last 3 months. It is quite urgent as I have trouble with the system configuration.

View 5 Replies View Related

Ubuntu :: Run Command Lines On Boot?

Sep 11, 2010

how i run the following lines onboot

code:....

/media$ sudo mount /dev/sdb1 /media/mediaStorage1
/media$ sudo mount /dev/sdc1 /media/mediaStorage2

View 5 Replies View Related

General :: Triming Lines Using Shell Command?

Mar 22, 2011

i have a text file generated automatically from a script , but the result in the script is not ordered in a readable way, so i need your help to fix it using a shell command the text file contain data in this way :

Code:

0.147361 0.243688 0.081520 -0.446603 1.130529 NC_000846 Chordata
Rheiformes
Aves
0.091740 0.379224 0.021160 -0.088493 3.441356 NC_000857 Arthropoda
Diptera

[code]....

i want to arrange the data in this text file in a way that each line will concatenate the 2 lines after it , so that will be 1 line , i want all the lines to be treated in this way ,

View 2 Replies View Related

General :: Multiple Lines At The Command Line?

Feb 22, 2011

I've seen a few tutorials that have commands and parameters on multiple line, like the one below:

Code:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

I can copy and paste this in Putty, but what if I want to manually type it? If I press return, the first line gets processed, so how do I insert a new line?

View 4 Replies View Related

General :: Breaking Long Command Into Lines In Crontab

Oct 14, 2010

How to break strings of command into multi-lines in crontab? e.g.
Code:
# the following is a very long a gruesome command to be run at 09:59 Monday to Friday.
59 09 * * 1-5 source $HOME/some-definitions; sh /usr/local/my/long/name/application/bin/hello $(date +\%Y\%m\%d) >>/var/log/my/long/name/application/log/hello.log

View 2 Replies View Related

General :: Command To Swap Even And Odd Numbered Lines In A File

May 28, 2010

I'm looking for a command to swap the even/odd numbered lines in a file. Example input file:

Code:

1
2
3
4

[code]...

Example output file:

Code:

2
1
4
3

[code]....

I'm sure there's a way to do it with sed, awk, grep and the like but it's been many years since I've used these commands on a daily basis and I can't seem to figure out the correct syntax.

View 2 Replies View Related

General :: Check Version Of Program Using Command Lines?

Jan 20, 2010

How to check the version of a program, in particular geant4, in linux using the command lines?

View 4 Replies View Related

Server :: Set The Cat Command To Read Specified Lines Of A Text File?

Feb 17, 2011

how can I set the cat command to read specified lines of a text file,like if I have a text file with 100 lines, who can I say cat only line 23 to 42?

View 3 Replies View Related

Fedora Installation :: What Are The Command Lines To Install Gnome But With The Minimal

Jan 24, 2011

installed fedora with the minimum option on the dvd. After that i logged it and im tring to install gnome, heres the catch though i only have 950MB worth of space. I noticed if i use the groupinstall "X Window System" it fails because of the space. Also it installs alot of things that I am not interested. what are the command lines to install gnome but with the minimal, no FF, no evolution, you get my point.

View 3 Replies View Related

Server :: Display All Databases And Their Size Using Command Lines In Mysql?

Aug 7, 2010

how can I display all databases and their size using command lines (linux) in a mysql server?

View 3 Replies View Related

Programming :: Awk - Get A Block Of Lines?

Apr 23, 2010

I tried to get a block of lines in awk, but unfortunately it returns output of one line only. I don't state the code here, because it's too short and too poor. What exactly I wanted to do: from file "/boot/grub/menu.lst" get blocks of lines, starting by title and ending by Now I have just

Code:

script="/boot/grub/menu.lst";
OLDIFS=$IFS; IFS=$'
';

[code]....

I want to get every block as one row of array.

View 14 Replies View Related

Programming :: Take A Int From 2 Lines Of Text?

Apr 20, 2011

I do a logcat, i got lot of lines, that I filter with a grep, at end, I just got some lines like this:

Code:
I/ActivityManager( 1763): Config changed: { scale=1.0 imsi=732/123 loc=es_ES touch=3 keys=2/1/2 nav=2/1 orien=1 layout=17 uiMode=17 seq=15}

[code]...

View 6 Replies View Related

Programming :: Remove All Lines Containing 'A,,,,,,?

Nov 3, 2010

How can I remove all lines which contain A,,,,,, I tried the following sed statements but no luck.

Code:

sed "/A,,,,,,/d file"
sed "/A,,,,,,/d file"

View 6 Replies View Related

Programming :: Three Lines Of Code - What Do They Actually Mean

Feb 23, 2011

whichever source code I go through I find these three lines of code written what do they actually mean and what is their function?

[code]...

View 6 Replies View Related

OpenSUSE :: Count Lines In Multiple Text Files From Command Line?

Apr 27, 2010

I want to (from the command line) be able to counte lines in a bunch of files of a specific type in a folder and all its sub-folders. How would I do this?

View 1 Replies View Related

Ubuntu :: Command Not Found \ Edit The 2 Files And Delete The Insert Lines?

Mar 10, 2010

i try do modify BASHRC and ENVIRONMENT files on directory ETCthen all the command don't work, such as:SUDO, GEDIT, NAUTILUS, NANO and some others!now i want to edit the 2 files and delete the insert lines

View 9 Replies View Related

General :: Tcpdump/ngrep Sniff Packet Network Command Lines?

Jun 21, 2011

I would like to know the command lines for;

-detecting the wifi in my house without being connected to it

-getting ips/macaddress from the people connected to the wifi

View 2 Replies View Related

Programming :: AWK: Join Lines If NF Is Wrong?

Jul 1, 2010

I have a large CSV file, tab-delimited with CRLF at the end of each line. Each line should contain 5 fields (i.e. NF == 5) However, there are rogue CRLF characters in the middle of some records, causing records to be split across two lines. I want to scan each line, check the field count and if it's !=5 then join that line to the following line. Example input might be;

Code:

one two three four five
six seven eight nine ten
eleven tw<CRLF>
elve thirteen fourteen fifteen

[code].....

View 2 Replies View Related

Programming :: Awk - Summing Over Specific Lines?

Mar 31, 2011

I'm struggling myself with this problem: I have a file which contains a single column of data

2
.
.
.
45

[code]...

Is there a way to do it with awk?

View 7 Replies View Related

Programming :: CSS - Put Several Lines Of HTML Into One Line Using CSS?

Dec 14, 2008

I've got a website set up which has a section which is just a bunch of links on the side. But this section of links is on every page of the website. And when I expand and add more links I don't want to have to go to every page and add the new link. Is there a way that I could put all the links into something on CSS (or anything else) that I could just include one line in the HTML? So that when I add a link I'll only have to edit the one file and and then every page will be updated?

View 12 Replies View Related

Programming :: Delete Lines Between Match?

May 15, 2011

My problem is like this I have to delete all lines between two pattern match example- suppose below is the content of the file then i have to delete all lines between text1 and text2

...
text1
abc
def
ghi

[Code]....

View 14 Replies View Related

Programming :: Deleting Lines Above And Below A Word

Mar 25, 2011

i jst want to delete a host entry from httpd.conf the entry for lal.com should be deleted!!

View 14 Replies View Related

Programming :: How To Add Characters And Lines To File

Jan 29, 2011

For example, I have a file called "file" like this one:
type=strongsubj len=1 word=absolve pos=verb stemmed=y priorpolarity=positive
type=strongsubj len=1 word=unique pos=adj stemmed=n priorpolarity=neutral
type=strongsubj len=1 word=absolutely pos=adj stemmed=n priorpolarity=neutral
type=weaksubj len=1 word=taking pos=verb stemmed=y priorpolarity=positive
type=weaksubj len=1 word=friend pos=noun stemmed=n priorpolarity=positive
type=weaksubj len=1 word=usually pos=adverb stemmed=n priorpolarity=positive
type=strongsubj len=1 word=purecolor pos=anypos stemmed=n priorpolarity=negative
type=strongsubj len=1 word=accusingly pos=anypos stemmed=n priorpolarity=negative

I want to add the plural for the noun, for example if find this line:
type=weaksubj len=1 word=friend pos=noun stemmed=n priorpolarity=positive
will add one more line :
type=weaksubj len=1 word=friends pos=noun stemmed=n priorpolarity=positive
where we add "s" for the word friend
I did try to do like that:
<code>
cat file | while read LINE ; do

set -- ${line}
if [[ "${4#pos1=}" == "noun" ]];then
#I tried this line but it doesn't work properly:
v3==$(echo $line |sed 's/$3/$s') #I want to find the third word "word=friend" in that line and add "s" after that word
# I don't know what command to add this new line "$v3" to the file ???
done
</code>

View 12 Replies View Related

Programming :: Indent The File Lines Using Vi?

Oct 1, 2010

Every now and then I have to indent the lines in my script to 4 space characters. I generally do it line by line. Is there an automated command in vi using which I can indent some set of lines to desired number of space characters in one go.

View 5 Replies View Related

Programming :: List 10 Lines By Same In Bash?

Mar 30, 2010

I have a file witch I need to list 10 line by 10 lines with something like press enter to go on in between.
Well, the problem is that i have absolutely no idea on how to implement this.

Can you give me some points?

View 3 Replies View Related

Programming :: Modify Lines That Are Too Long?

May 25, 2010

I have a CDL netlist with 5630 lines. 512 of the lines are over 128 characters. The tool I am using to read in the CDL returns an error for each line over 128 characters.

If the line is too long I can fix it by adding a line continuation symbol, in this case a "/", somewhere prior to the 128th character then a line feed, obviously, and a "+" to the continuation.

example (pretend its a long line);
before;
this line is too long
after;
this line /
+ is too long

Part of the problem is that I can't use a constant point prior to the 128th character because I can't break up a term.

bad;
this line i /
+ s too long

If I can replace the last space before the 128th character with " / + " on all lines that are over 128 characters then I'm golden. I'm not sure if I need to escape the + or not. If so then the substitution is " / + ". And if I use sed then I'll escape the .

View 6 Replies View Related

Programming :: Displaying Particular Lines Via Grep ?

Apr 8, 2011

So For example I run this command:

Code:

But want to gerp / cut it in such a way that it only displays

Code:

Now the thing is that these 3 lines are not static.. there can be N number of lines there.. the only thing is that I want the command / output NOT to display the first line but the rest of the n lines ..

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved