Programming :: Check Command Line For A Word?

May 23, 2010

I'm building a script for my place of employment. The next step in it is checking what the user input was. Determining if they added a part in there or not. The script prompts for a hostname. Hostnames are localhost.localdomain. Now, I want the script to check to see if they put localdomain and if they did, not to add the domain to the /etc/sysconfig/network, but just what they entered. So say the user inputs:

[Code]....

View 4 Replies


ADVERTISEMENT

General :: Search Word And Delete Only The Word And The Line Using Sed Command?

Jun 28, 2011

Want to search for ~ and delete it as well as to append the entire line to the above line. For Ex:

1111xxxx date Sandy area is ~around this area.3222xxx date There seems to ~left side of map, the colours are accurate (showing green areas)Even if I ~zoom in, the green parks, xxx3258 date The dammed up
~away, the "other" body of water varies ~blackNatural gas leaching.

IT MUST LOOK LIKE:

1111xxxx date Sandy area is around this area. 3222xxx date There seems to left side of map, the colours are accurate (showing green areas)Even if I zoom in, the green parks, xxx3258 date The dammed up away, the "other" body of water varies blackNatural gas leaching.

View 4 Replies View Related

Programming :: Check For Word Frequency In 1 Column

Jul 6, 2010

I have a large tab delimited text file, about 17gb. It only has 6 column. On column number 4, it is all numbers. Ranging from 1-1000. I want to count how many times each number occured. So the output I want is in 2 columns, first one is a number, second column is how many times it occured. I tried

head -n 1000 coverage | cut -f 4 | uniq -c

Didn't work for me, the first column returned is not unique.

View 3 Replies View Related

Programming :: Access A File Line By Line, And Check The Length Of Each Line.

Feb 13, 2011

I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?

View 1 Replies View Related

Programming :: Bash Script - Grepped A Log File To Obtain Every Line That Contains A Word

Dec 8, 2010

I have grepped a log file to obtain every line that contains a word (let's call it 'blah'). I now want to only display a list of entries within that search result that feature the word 'host' anywhere in the line, and I also want to display the single word *after* 'host' (up until the next space). So, the end result will look like this:

[Code]....

View 8 Replies View Related

General :: Sed Append Word At End Of Line If Word Is Missing

Feb 19, 2010

I have to modify formsweb.cfg file in Oracle IAS.

Problem description

In formsweb.cfg file are two lines with labels archive_jini= and archive= at the beginning of line. After equal sign (=) is row of filenames of java archives delimited by coma(,). When I insert a new jar file in java directory, I have to append the very same name of jar file to both lines if that name is not yet present.

Example snippet from formsweb.cfg

View 2 Replies View Related

Programming :: Creating A List Of Word Using Tr Command

Jul 11, 2010

I have a file having name test.txt content of which is following My Self is Arvind Kumar.My Date of Birth is 21/07/1984.I am 26 year year old.I did M.Sc Informatics from Delhi University in 2008.I did B.Sc Electronics from Acharya narendra Dev college Delhi University.I did my schooling from DAV Yusuf sarai.Curren tly I am working with InterGolbe Technologies as a Associate software Engineer.I want to be Linux Expert. What I am doing I am creating a list of words,But i want to take B.Sc and M.Sc as a single word

[Code]....

View 5 Replies View Related

General :: Check DVD Region Code From Command Line?

May 3, 2010

Is there a way to get DVD region code from command line (linux/ubuntu 9.10)? I want to script this action and store the region code (and other data about DVD) in a log.

I am looking for the info about media, not the drive.

View 1 Replies View Related

General :: Command Line - How To Check If DVD/CD Is 32bit Or 64bit

Sep 3, 2010

Is there any command on linux to check if CD or DVD is 32bit or 64bit?

View 2 Replies View Related

General :: Check If A Directory Exists In Command Line?

Jan 21, 2010

How to check if a directory exists in Linux command line?

[Code]....

View 5 Replies View Related

Ubuntu :: Check If A Package Is Installed Via Command Line?

Aug 20, 2010

After sifting through numerous apt-get apt-cache apt-file tutorials I still can't find a command to check if a package is installed via the terminal command/line.

I know there must be some way to do it.

Say I want to check if any package from the libavcodec*.deb family is installed how could I do this without a gui eg synaptic?

View 5 Replies View Related

Debian Configuration :: Check Battery Levels Command Line?

Feb 12, 2011

since I am on a Dell inspiron 1545 laptop, being able to display my battery charge is critical. After some extensive googling, I found I need a command 'acpi', which does not exist on my computer. I cannot seem to find it in the packages database; the closest thing being 'acpi-support' apt-get install also can't find it.

I tried cat /proc/acpi/battery/BAT0/state, but that only shows me if the battery is discharging or charging and doesn't give me an actual percentage.

View 1 Replies View Related

Ubuntu :: Check Installed Versions Of Apps From Command Line?

Sep 8, 2010

Like i'm curious what version of wine i have installed...What are my current ati drivers installed...If wine isn't 1.2 or 1.3 how do i update it from command line?really any insight into this process would help its not absolutely critical to know but i've been looking around and haven't found informationOr some references to good articles to become a command line guru would be cool as well.

View 8 Replies View Related

Programming :: Read Two Files Word By Word At A Time Using Any Loop By Shell Script?

Mar 4, 2010

Well, I am facing one issue:How can i read two files word by word at a time using any loop as i need word by word comparision in shell script?Please let me know pseudo code.

View 14 Replies View Related

Programming :: Bash Shell Script Read File Word By Word?

Jan 21, 2011

I have a output file look like this:
{"test1" : "test2", "test3" : "test4"},

How can I read word by word in each line?This is not working code:

a=0
while read word
do a=$(($a+1));

[code]...

View 14 Replies View Related

Programming :: Bash Read Input Word For Word ?

May 4, 2010

I am pretty new to bash scripting...I am trying to write a script that will take an input and read it word for word and then DO something with it like echo. I have been able to find how to read word for word from a file but I don't know how to do it with input.

I was looking for something like

Code:

exit 0 The input would be A-Z a-z 0-9 and have a single space between each word.

View 2 Replies View Related

General :: Command Line To Check For A Specific Email - By Subject - On An SSL Secured IMAP Server?

Feb 1, 2011

Anyone know a simple command line to check for a specific email - by subject - on an SSL secured IMAP server?

View 2 Replies View Related

Programming :: Effect Of Using Eval To Execute A Command As Opposed To Writing It On The Command-line?

Jun 18, 2010

Code: cmd='date | wc'

$cmd If this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument".What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine.then | is not treated as an argument. Why?

View 4 Replies View Related

Programming :: Command Line Invocation Of Gnome-terminal To Run More Than One Command?

Feb 16, 2010

I am trying to learn how to pass more than a one-command startup for gnome-terminal.

I will give an example of what I'm trying to do here:

Code:
#! /bin/bash
#
#TODO write this for gnome and xterm
USAGE="
${0##*/} [-x] [-g]
code....

However, running with the -g option to invoke gnome-terminal, I get a "There was an error creating the child process for this terminal" error.

This same error occurs if the gnome-terminal line is changed to

Code:
gnome-terminal -e mcTerm

Is there any way to pass more than one command on to gnome-terminal? I have tried various single and double quoting senarios and in a final attempt, I abstracted to an exported function all to no avail. Perhaps even though gnome-term is better at many things than xterm, xterm trumps it in this instance.

View 4 Replies View Related

Programming :: Convert This Awk Command From Command Line Into An Awk Script ?

Oct 15, 2010

I'm trying to convert this awk command from command line into an awk script, but just cannot get it to work:

This is what i have after my BEGIN

Am i missing something here? this just prints out the count for everyline, not counting lines on 5th field that match 'A'

View 1 Replies View Related

Programming :: SQL Script To Check Status Of Last Command?

Aug 7, 2009

I need to make a SQL script and call it from Unix (bash) shell.

Code:

sqlplus vikas/vikas <<END
spool /oracle/vikas/output.txt
command 1

[code]....

This runs perfectly, but my problem is that if a command fails, the other commands keeps on running. I need to keep a check that when a command fails the script is exited. In unix we have an option of echo $? to check the status of previous command, But how to accomplish this SQL.

View 2 Replies View Related

Programming :: Command In Bash Script To Check If Tar Is Currupt Or Not?

Jan 20, 2011

As part of my script I need to compress a 50Gb file. but I need to check that the compressed is not corrupt if it is ok it will then send it over if not it will report an error.

cd /home/ops/Desktop/temp
tar czvf backup-"$(date +%d-%b-%y)".tgz /home/ops/Desktop/temp

I need some here to check the compress file then somelike if the file is

if
send the file
else
send an e-mail reporting a failure

View 4 Replies View Related

Programming :: Tutorial For Using GDB From Command Line?

Sep 15, 2010

Does anyone know from experience a good gdb tutorial, so I can learn to use it from the command line.

View 2 Replies View Related

Programming :: Making A 1 Command Line Argument?

Jun 8, 2010

I need to write a script that will take 1 command line argument. The argument will be a username. The script will determine if the user exists on the system and will print an error if it does not. If the user does exist it will determine if the user is currently logged in, if the user is not logged in it will determine the last time the user logged in and display the file in the users home directory that was most recently modified.

View 2 Replies View Related

Programming :: Set For A Group Of Command Line Arguments?

Oct 11, 2010

i was wondering if someone could help me figure out a script for global variables i'm trying to set for a group of command line arguments:

basically i'm trying to set: if $# = 3 then i want to search for each all string $1 $2 $3

if $# = 4

then i want to search for each all string $1 $2 $3 $4

View 2 Replies View Related

Programming :: Echo Two Command Output In The Same Line?

Jan 25, 2011

I try to write script and echo two command at the same line .

echo "A"
echo "B"

How can I pipe above two command at the same line in text file . So, in the output text file , you can see below ? Code: A B not Code: A B

View 4 Replies View Related

Programming :: Using An Awk Command To Print A Line From A Cvs File?

Mar 4, 2011

I 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

View 3 Replies View Related

Programming :: Program That Activates A Command-line?

Feb 7, 2010

I am wanting to write a program that runs a program or command-line. Is there are way of making a program that activates a command-line (for example executing 'ps -a -f' or '/home/shared/fah').

In addition to that, I want the program to do a 'ps -a -f' and put the results in a buff, how could I do this.

View 5 Replies View Related

Programming :: Debugging QT Project Through GDB In Command Line?

Jan 31, 2011

First step will obviously be to compile the QT project with -g option, but how to do that through command line?

View 6 Replies View Related

Programming :: Diverting IDL Output To The Command Line?

Jul 14, 2010

I'm troubleshooting a batch of scripts I'm modifying, including an IDL script called by a .csh script. the IDL scripts were provided to me by a coworker and my .csh script is intended to automate a lengthy set of extremely tedious and time consuming processing tasks.

I am currently in the process of debugging, and can't get the IDL to print any messages other than critical failures to the screen. Is there any easy way to redirect the stdout to either a logfile or the screen?

View 2 Replies View Related







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