Networking :: Bash Test Script Which Reads Lines From A File, Builds ISO Messages?

Mar 11, 2010

Here the description of the issue I am having.I am writing a bash test script which reads lines from a file, builds ISO messages, sends them to a server, reads the response with response code and reports the result of the test to a file or on the screen.The message that I need to send is 94 characters long.Here's the portion of a code that I initially wrote:

#~ Open socket.
exec 3<>/dev/tcp/172.26.0.25/9991
#~ Send msg.

[code]...

View 4 Replies


ADVERTISEMENT

Programming :: Bash Script That Reads Lines In While Loop

May 26, 2011

So I need to write a bash script that can read lines and column 3 from a file. It needs to start on line 16 and read every 20th line starting from there. But the value that it reads needs to be checked, should it be too great I need it to shut the program down.I'm pretty new to bash, but my ultimate goal is being able to safely run a program on a GPU for an extended period of time with out worrying about it overheating. I have a command that outputs information from the GPU every second, and I can save this to a file. So all I really need is something to read and check that file, I played around a bit with the awk command and can't get it to work within my for loop with dynamic variable.

View 7 Replies View Related

Programming :: Bash There Will Be Empty Lines At The End Of The File?

Mar 26, 2011

Using awk I pull the first field of a random line from my datafile.myvar1=`awk -F" " 'NR=='$randline' {printf "%s", $1}' myfileThis works fine. The problem is there will be empty lines at the end of the file. Rather than using awkto filter out blank lines I would like to figure this out first.So I test $myvar1 for a blank string after setting $randline to one that I know is blank:test -z "$myvar1" && echo "true" || echo "false"But, this returns "false"? So the string is not zero length. Why? It's a tab-separated file. Is awk storing the tab with the $1 field or something.This is where I get headache. I try to echo my variable to see what it looks like.

echo "$myvar1"
outputs: nothing
echo "My variable is [$myvar1]"
outputs: [y variable is [

Why is the closing bracket at the beginning? What character could be stored in $myvar1 that would do such a thing and how did it get there?

View 7 Replies View Related

Programming :: (BASH) How To Read Multiple Lines From Text File

Mar 11, 2011

For example, I have a text file with data which lists numerical values from two separate individuals

Code:
Person A
100
200
300
400
500
600
700
800
900
1000
1100
1200

Person B
1200
1100
1000
900
800
700
600
500
400
300
200
100

How would I go about reading the values for each Person, then being able to perform mathematical equations for each Person (finding the sum for example)?

View 13 Replies View Related

Ubuntu Networking :: Test For BT Pairing In Bash?

Dec 18, 2010

I want to test whether or not my phone is connected from bash. I'm finding lots of information about /dev/rfcomm0, but that's not on my system (Ubuntu 10.04). The device pairs just fine, and I can connect with gammu just fine, and I have the device address ("00:1F:5D:37:17:FB").I just need something I can put in a bash script to say "Is this connected or not" akin to testing for a file's existence:

Code:
if [ -f /home/steven/arbitrary filename ]
then

[code]....

View 2 Replies View Related

General :: Bash Script That Reads Files In Directory And Processes Them?

Jan 22, 2010

I am trying to create a function within my .bashrc that will process all of the files that do not end with .sh within a directory and execute them.The following is what I have so far. I am missing a way of excluding files that end with .sh though.

function startall {
for file in /etc/init.d/*.; do
"${file}" start

[code]...

View 2 Replies View Related

General :: Difference Between Buffered Disk Reads And Cached Reads?

Jul 13, 2011

I was analyzing the Disk read using hdparm utility. This is what i got as a result.

Code:

# hdparm -t /dev/sda

/dev/sda:

Timing buffered disk reads: 108 MB in 3.04 seconds = 35.51 MB/sec

Code:

# hdparm -T /dev/sda

/dev/sda:

Timing cached reads: 3496 MB in 1.99 seconds = 1756.56 MB/sec I m not sure what does Cache read and buffered disk read mean.

View 1 Replies View Related

Ubuntu :: Add These Lines In The Test.cfg, But Its Not Working?

Mar 22, 2010

IM using Ubuntu 9.10 running from USB,

My current text.cfg --->

default live
label live
menu label ^Run Ubuntu from this USB

[code]....

i tried to add these lines in the test.cfg , but its not working. i do hav these folders and files with in the disk,

View 1 Replies View Related

Ubuntu Installation :: Warning - Can't Create Test File /var/lib/mysql/mosty.lower-test

Mar 15, 2010

I am trying to install mysql 5.1.44..so i downloaded the binary package, i extracted it and then followed the instructions that were in the manual but i keep getting this error when running this command

Code:

scripts/mysql_install_db --basedir=/home/mosty/mysql

the error is

Code:

Installing MySQL system tables...
100315 20:07:27 [Warning] Can't create test file /var/lib/mysql/mosty.lower-test
100315 20:07:27 [Warning] Can't create test file /var/lib/mysql/mosty.lower-test

[code]....

You can try to start the mysqld daemon with:

shell> /home/mosty/mysql/bin/mysqld --skip-grant &

and use the command line tool /home/mosty/mysql/bin/mysql to connect to the mysql database and look at the grant tables:

shell> /home/mosty/mysql/bin/mysql -u root mysql
mysql> show tables

View 1 Replies View Related

General :: Replace Several Lines In A File With Other Lines In Another File?

Oct 26, 2009

I have this massive table file with some data in it and I want to replace some lines that are wrong with the correct ones that are in another table file of the same format. The wrong lines are not all together in a block but randomly distributed so I need to make a loop checking if the line is in the other file and if it is, replace it. I want to try and do it with sed or awk but I don't really know how to....

View 12 Replies View Related

Networking :: Sending Test Data From File To Port And IP

Apr 23, 2009

I'm working on testing some software, and I have a question. We have several files of binary data that we need to push through our application to test. It communicates via simple TCP sockets. Is there a way I can send this data to the socket from the command line? I tried doing something like this, but telnet never picked up the data.

View 5 Replies View Related

Ubuntu :: Reads Only One File On D Drive After 10.10 64 Bit Install

Dec 26, 2010

Due to crash of 10.04 grub, I installed it again from a live CD on D drive "C drive has windows 7", then immediately after install, I upgraded to 10.10 64 bit. Need to change the boot to Windows loader and not directly to Ubuntu as it happens now. I see "windows loader as an alternative option" and it works when I select it. when I boot to windows, my computer icon reads only one file on D drive "bootsqm.dat". from Ubuntu computer option, I can access all windows files.

View 3 Replies View Related

CentOS 5 Networking :: Syslog-ing Messages From A Particular Host To A Particular Log File

Oct 12, 2009

I've just configured my Linksys RVS-4000 router to syslog messages to remote syslogd server (i.e. my CentOS5 machine). Redirecting messages was easy, but now I'm having difficulties to redirect those same messages received from Linksys to a separate log file. By default, all these messages are logged to /var/log/messages, and after browsing manual pages for syslog, syslog.conf, and syslogd, came to suspect that what I want isn't possible.

View 1 Replies View Related

Ubuntu Networking :: How To Test Cifs Is Actually Mounted In Script File

Mar 12, 2010

I would like to be able to test that a network mounted cifs(samba) share is actually mounted in a script file to do backups. I want to do this so that when my automatic backups run they actually go to the remote location or fail. Currently, if there is a network problem that prevents the network share from mounting, the files simply get copied to the folder (e.g. /media/backupmount) and end up filling up my small local hard drive.

View 3 Replies View Related

General :: Shell Script That Reads From Parameters File?

Nov 3, 2009

what I am trying to do but I am not sure exactly how to do it. I want to write a shell script that will replace certain values in a file with environment specific information that it pulls from a parameters file. The paramaters file looks like the following...

[dev]
ip=10.15.109.41
name=dev1.mydomain.com

[code]...

View 4 Replies View Related

Ubuntu Installation :: Install Through Terminal Always Reads That Theres No File Found Or Can't Complete?

Jan 23, 2010

i just installed ubuntu and i wanna put wine on so i can install my itunes and adapters an so on. but when i try to install through terminal it always reads that theres no file found or cant complete installation. and theres no net hooked up to it cuz the wireless adapter wont work.

View 3 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

General :: Program That Reads Multiple Pipes / File Descriptors And Writes To Standard Output

Feb 23, 2011

Is there already a program that reads multiple pipes or file descriptors and writes to the standard output (not splitting lines).Like cat, but reading all files simultaneously and preserving lines.It is needed to avoid coding of select/epoll loops or using multithreading in simple programs. Like "select loop for bash".

View 1 Replies View Related

General :: JAVA_HOME In Bash Script Test

Sep 4, 2009

I was wondering why

Code:

Is echoing NO even though

Code:

View 2 Replies View Related

Ubuntu Networking :: Installing Newer Version Of Network-manager In Lucid - From Daily Trunk Builds Ppa

Aug 9, 2010

This is only for Lucid and Maverick, as there's no 0.8.1 builds for other releases in this ppa. Why?

Because today there seems to be a fuss about 3g usb-modems. And as of network-manager version 0.8.1, there is added support for those and some more.

The release features for current version 0.8.1, from gnome.org

Lucid ships with an earlier version and there's a ppa for daily builds (that could break, so use it on need-only-basis).

Visit the link, or google: NetworkManager daily trunk builds for ubuntu

Follow the steps on the site to add it in the repositories.

After that, it's just a simple

Code:

apt will update the needed files. Then reboot, you're done.

I strongly recommend, that you disable the PIN code query for your SIM card and enable 'Connect automatically' from:

As this seems to be more reliable than connecting/reconnecting manually from the applet list. After that, it's plug&play.

I use the modem Huawei E1820 (uses option1 driver) and for me, this update...
- gives you the ability to choose the desired network; 3G only, 3G pref., EDGE etc.
- Then it shows the signal strength and the technology used atm.; HSPA, UMTS etc.

And the main reason I installed it, bluetooth DUN support. So far it has been working great with Lucid on 32bit architecture, and I don't have to disconnect the modem between boots, or after suspend/resume.

View 9 Replies View Related

Programming :: Bash Calculate The Repeated Lines?

Jan 28, 2010

i have a sorted file with many repeated lines like this:

1ujw
1ujw
1ul1
1us7

[code].....

i need to calculated haw many times each line is repeated, for ex

1ujw 2
1ul1 1
1us7 5
etc.

View 5 Replies View Related

Programming :: Get Rid Of Unwanted Lines Without Grep -v In BASH?

Jun 9, 2009

I would like to know how I can get the ouput from the following dmidecode command in example 1 to look like example 2 without having to grep -v all the unwanted lines.Is there a way in awk or sed?Example 1

Code:
Processor Information
Socket Designation: Socket 1 CPU 1

[code]...

View 7 Replies View Related

Programming :: Remove Extra New Lines (BASH)

Jul 15, 2010

I'm trying to search through some pdf files and I'm doing so by converting them to text files using pdftotext which is fine but I'm trying to get the number of occurrences in a paragraph of different words and it's adding a new line character at what it thinks is the right hand margin. I'm trying to remove all these singe new line characters but keep the doubles and I can't seem to work it out. i.e.

This is some text that has been broken.
Another paragraph.
becomes
This is some text that has been broken.
Another paragraph

View 9 Replies View Related

Server :: Bash Script To Test String Complexity

May 12, 2010

I'm looking for a script which is testing how complex an "added" string is, for example like the user is changing his password and check how complex it is, if it included letters (lower/upper case), numbers and other characters.Im doing this for password check, the user type's the password and must be 6 characters long, have upper case letters lets say and numbers and so on.If anyone knows where I could find some bash script which is doing this, it would be really cool.

View 2 Replies View Related

Programming :: Bash Script - Test Variable Against A Range?

Jan 28, 2010

I am fairly new to bash scripting, and I am trying to test a variable against a number range (1-3). This is what I have used so far: The user enters a value, then

while [ "$PROV" != "1" ] && [ "$PROV" != "2" ] && [ "$PROV" != "3" ] && [ $COUNTER -lt 4 ] || [ -z "$PROV" ] && [ $COUNTER -lt 4 ]; do
clear
echo

[code]....

Is there a cleaner way to do this? Something like:

while [ "$PROV" != "1-3" ]&& [ $COUNTER -lt 4 ] || [ -z "$PROV" ] && [ $COUNTER -lt 4 ]; do

View 3 Replies View Related

Programming :: Bash - Test If First 2 Characters In A Filename Are Numbers?

Oct 21, 2010

I have a directory with files like this:

Code:

And what I'd like is to have the files renamed like this:

Code:

How could I code it so that it removes the numerical part of the filename (at the beginning), even with different patterns (like the 01 - artist vs the 01-artist)?

View 8 Replies View Related

Ubuntu :: Get An Error Message That Reads "the Ext4 File System Creation In Partition #1 Of SCSI3 (0,0,0) (sda) Failed?

May 15, 2011

When reinstalling ubuntu 10.04, I get an error message that reads "the ext4 file system creation in partition #1 of SCSI3 (0,0,0) (sda) failled.

View 1 Replies View Related

General :: Bash Script To Find Lines Containing Two Different Strings

Mar 13, 2011

I'm trying to write a bash script to find all lines containing two different strings in many files. I don't have access to egrep so I want to use sed for this purpose.

The files will look like this:
FileX
------
Info:18
Data:76
Contact:me@home.com
Start:1500

I want to generate a new file from these files with only the rows containing Data and Start. Something like this:
for y in `ls /file*.db`;
do sed '/Data|Start/p' $y > newfile
done

View 7 Replies View Related

General :: Use Sed In Bash To Match Pattern Contained In 2 Lines?

Mar 14, 2011

I have a file called test. It has the following contents.Code:there youI want the output to be.Code:replaced youI am trying to use the sed command to replace every occurance of "hey newline there" with "replaced". I tried the following naive apporach.Code:sed 's/heythere/replace/' testThis gives a result containing the same data as the test file.

View 3 Replies View Related

General :: Referance To The Bash Shell / Use The Test Command To Evaluate?

Nov 8, 2010

Cis 140 student.how to use the test command to evaluate whether the shell variable I create contains a referance to the bash shell? and use the echo command to determine the result.

View 1 Replies View Related







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