Tag Archives: LINE

With Nearly 200M Users, Messaging App LINE Is Gunning For The U.S.

By Parmy Olson, Forbes Staff

Mobile messaging apps are fast becoming more than just messaging apps. KakaoTalk and Kik are turning into social platforms that host third-party apps and games. LINE, which started off as an app offering free texts and calls, wants to be a fully fledged entertainment platform. …read more

Source: FULL ARTICLE at Forbes Latest

Checking number of commas in each line.

By Anupam_Halder

Hi All,

I am checking whether each line is having “n” number of commas or nor. In case not then I need to exit the process.

I tried

Code:

cat "$TEMP_FILE" | while read LINE
do
processing_line=`expr $processing_line + 1`
no_of_delimiters=`echo "$LINE" | awk -F ',' '{ print NF }'`
if [ $no_of_delimiters -ne $no_of_expected_fields ]
echo "Error at line $processing_line"
exit
fi
done


It’s working fine. However the number of records in the file is around .5 million. So it’s taking too much time to process it. Anyway I can improve the performance?

Thanks in advanced.

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Comparing two variables

By ghostmic

I have a script like this. Just couldn’t get the comparison part work. Any thought? thanks,

#!/usr/bin/ksh -x
STEP=`echo $(basename $0 .ksh) | tr “[a-z]” “[A-Z]”`
log=/skip.log
while read LINE
do
if [ “$LINE” = “$STEP” ]
then
echo `date`: STEP $STEP skipped by user >> $log
exit 0
fi
done < $1

echo `date`: STEP $STEP starting >> $log

+ + basename ./skip.ksh .ksh
+ tr [a-z] [A-Z]
+ echo skip
STEP=SKIP
+ log=/skip.log
+ 0< /skip_list.txt
+ read LINE
= SKIP ]
+ read LINE
= SKIP ]
+ read LINE
= SKIP ]
+ read LINE
+ date
+ echo Mon Mar 18 15:28:50 EDT 2013: STEP SKIP starting
+ 1>> /skip.log

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Finding DIR

By Roozo

Done this basic level script called mydir that prints the message File is a directory if
the file is a directory.

#!/bin/kasha

cat LIST | while read LINE
do
if [[ $? -eq 0 ]]
then
ls -ltr $LINE >out
give=$LINE
grep $1 out > out.txt
grep ^d out.txt
if [[ $? -eq 0 ]]
then
echo “Directory “$give
if
if
done

LIST file Contains Directory path
/dir/man
/dir/con
/dir/sam

If you have any better way to find plz post…

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Running script in Parallel

By morbid_angel

Hi Folks
I have a doubt. I have a script which is running with 2 input parameters

./GetDSLnkCount.sh Parmfile.txt

I need to run the script in parallel for different jobnumbers. The commands are

./GetDSLnkCount.sh jnhuc14500 Parmfile.txt
./GetDSLnkCount.sh jnhuc14501 Parmfile.txt
./GetDSLnkCount.sh jnhuc14502 Parmfile.txt
./GetDSLnkCount.sh jnhuc14503 Parmfile.txt
./GetDSLnkCount.sh jnhuc14504 Parmfile.txt

So What I have done is I copied all the above commands to File and doing like this

cat File|
{
while read LINE
do
$LINE $
done
}

So do you think this will run all the command in parallel or this will be in a sequence mode ?

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Cp: cannot stat No such file or directory

By Rami Reddy

Hi

Please review this script and let me know what i need to do.
This is my script

Code:

#!/bin/bash
#SCRIPT: forms.sh
#PURPOSE: Process a file line by line with redirected while-read loop.
#PURPOSE: and copy the forms to the follder

foldername=sample_dir
mkdir -p $foldername

while read file;
do
FILENAME=$(basename $file)

LINE=$FILENAME
count=0

cp $LINE $foldername/
done < forms.txt


i have a file called forms.txt which contains unix directory path.
i want to extract the filename alone from the unix directory path. now i am having copy issue with this script.
This is the error, i am getting

Code:

cp: cannot stat `AKDAPREG.fmb': No such file or directory
cp: cannot stat `AKDATTRS.fmb': No such file or directory
cp: cannot stat `AKDFLOWB.fmb': No such file or directory
cp: cannot stat `AKDFLOWS.fmb': No such file or directory
cp: cannot stat `AKDOBFKS.fmb': No such file or directory
cp: cannot stat `AKDOBJWB.fmb': No such file or directory
cp: cannot stat `AKDOBPKS.fmb': No such file or directory
cp: cannot stat `AKDPICKF.fmb': No such file or directory
cp: cannot stat `AKDQUERY.fmb': No such file or directory


Please let me know your suggestions.

Thanks,
Rami Reddy.

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Copying a file using variable

By Rami Reddy

Hi this is the code
i am using copying a file by using a variable
i have a file test.txt which contains 5 lines

Code:

#!/bin/bash
#SCRIPT: method2.sh
#PURPOSE: Process a file line by line with redirected while-read loop.

FILENAME=test.txt
count=0
foldername=OUTPUT
mkdir $foldername

chmod 777 $foldername

while read LINE
do
(( count++ ))
cp $LINE $foldername/

done < $FILENAME
echo -e "nTotal $count Lines read"


now, i am getting this error

Code:

cp: cannot stat `$AP_TOP/reports/US/APXINSWP.rdf': No such file or directory
cp: cannot stat `$AP_TOP/reports/US/APXINROH.rdf': No such file or directory
cp: cannot stat `$AP_TOP/reports/US/APXWTGNR.rdf': No such file or directory
cp: cannot stat `$AP_TOP/reports/US/APXVDREV.rdf': No such file or directory
cp: cannot stat `$AP_TOP/reports/US/APXVDLBL.rdf': No such file or directory


Please help me.

Thanks

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Process ssh command in while loop

By westmoreland

I have a script that reads a file containing a list of server names. It’s suppose to loop through the list of names and execute a command on the remote server using ssh. It processes the ssh command for the first server in the list and then exits. Here’s the code:


#!/bin/bash

FILENAME=server_list.txt

cat $FILENAME | while read LINE
do
echo "$LINE"

# Run the Users.sh script on the remote server
ssh root@$LINE '/usr/local/bin/Users.sh > /root/UserAccounts.txt'

done


When I comment out the ssh command the script processes as expected. Does ssh do something when it exits the first time that is maybe stopping the rest of the script from processing? I’d appreciate any suggestions.

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Bash script puts r at the end of variable

By westmoreland

I’m pretty new to bash scripts and I’m trying to work through some issues. Would appreciate any suggestions.

I have a list of servers in a text file (I used the FQDN‘s), I assign the file name to a variable, I then use cat to read the list of file names and echo them to the screen. But when it assigns the variable it seems to append a r to the end of the variables value. Although the r doesn’t show up unless I use the set command to debug. As you can see from code below, I’m trying to use a server list to perform a secure copy of my password files so that I don’t have to log on to each server. Here is the code snippet in question:

Code:

#!/bin/bash
#
set -x

FILENAME=server_list.txt

cat $FILENAME | while read LINE
do
echo "$LINE"
# mkdir /sysadmin/bin/passwd_audit/$LINE
# scp root@$LINE:/etc/passwd /sysadmin/passwd/$LINE-passwd.txt
# scp root@$LINE:/etc/group /sysadmin/passwd/$LINE-group.txt
# scp root@$LINE:/etc/sudoers /sysadmin/passwd/$LINE-sudoers.txt

done

set +x


Here are the first few lines in the file:

Quote:

api01r5v.lamar.edu
appworxdbdev.lamar.edu
appworxdbprod.lamar.edu
appwxdbdevr5p.lamar.edu


Here’s what the output from the script looks like:

Quote:

[root@netbkpmaster passwd_audit]# ./getinfo_script
+ FILENAME=server_list.txt
+ cat server_list.txt
+ read LINE
+ echo $’api01r5v.lamar.edur’
api01r5v.lamar.edu
+ read LINE
+ echo $’appworxdbdev.lamar.edur’
appworxdbdev.lamar.edu
+ read LINE
+ echo $’appworxdbprod.lamar.edur’
appworxdbprod.lamar.edu
+ read LINE
+ echo $’appwxdbdevr5p.lamar.edur’
appwxdbdevr5p.lamar.edu


Is this normal behavior? I’ve used this same script in the past and it’s worked fine for me. Not sure why it changed suddenly. Any suggestions would be greatly appreciated.

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Ex-Div Reminder for Linn Energy LLC

By DividendChannel.com Looking at the universe of stocks we cover at Dividend Channel, on 2/5/13, Linn Energy LLC (NASD: LINE) will trade ex-dividend, for its quarterly dividend of $0.725, payable on 2/14/13. As a percentage of LINE‘s recent stock price of $39.00, this dividend works out to approximately 1.86%, so look for shares of Linn Energy LLC to trade 1.86% lower ? all else being equal ? when LINE shares open for trading on 2/5/13.
Click here to learn which 25 S.A.F.E. dividend stocks should be on your radar screen » or click here to find out which 9 other stocks going ex-dividend you should know about, at DividendChannel.com »
Source: FULL ARTICLE at Forbes Markets

Reference of hash (Perl)

By askari

Hi Perl users,

Could somebody help me to find the solution of my problem below.
Here is my data:

Code:

__DATA__
===================================================
NameOfipaddress ippair_1
propertiesx y
propertiesy x
ipAddress_1 192.168.200.1
ipAddress_2 192.168.200.2
===================================================
NameOfipaddress ippair_2
propertiesx y
propertiesy x
ipAddress_1 192.168.200.3
ipAddress_2 192.168.200.4


Here is the expected result of the code:

Code:

__EXPECTED_RESULT__
FIRST_IP_PAIR
NameOfipaddress : ippair_1
ipAddress_1 : 192.168.200.1
ipAddress_2 : 192.168.200.2

SECOND_IP_PAIR
NameOfipaddress : ippair_2
ipAddress_1 : 192.168.200.3
ipAddress_2 : 192.168.200.4


Here is my code and the unexpected result:

Code:

LINE:while (my $line = ){
chomp ($line);
if ($line =~ m/^(NameOfipaddress)s*(.*)/){
push @{$datalog{'IP'}{$1}}, $2;
next;
}
if ($line =~ m/^(ipAddress_1)s*(.*)/){
push @{$datalog{'IP'}{$1}}, $2;
next;
}
if ($line =~ m/^(ipAddress_2)s*(.*)/){
push @{$datalog{'IP'}{$1}}, $2;
redo LINE if ($line =~ m/^(NameOfipaddress)s*(.*)/);
}
}

foreach my $key (sort keys %{$datalog{'IP'}}){
print "$key: @{$datalog{'IP'}{$key}}";
print "n";
}

__UNEXPECTED_RESULT(my code result)__
NameOfipaddress : ippair_1 ippair_2
ipAddress_1 : 192.168.200.1 192.168.200.3
ipAddress_2 : 192.168.200.2 192.168.200.4


Source: FULL ARTICLE at The UNIX and Linux Forums

Getting Command not found error Even though Script is working fine

By harpal singh

Hi friends,

I am using below script to do some work. But even though script is working fine but while executing it i am getting command not found error. 🙁

Here is the script :-

#!/bin/sh
Names=”name.txt”

###main#####
for LINE in `cat ${Names}`
do
Name=`echo $LINE |awk -F’|’ ‘{print $1}’`
`:$lableName`
echo $Name is unlocked
done
echo “Unlocking is done”

NOte:- its reading Names one by one from file and executing some commmnad. Functionality is working fine but i am not sure whey
“./script.sh: line 11: Unlocked: command not found” is coming.

Regards
Harpal Singh

Source: FULL ARTICLE at The UNIX and Linux Forums

Output as a html file

Hi

i want to store output in html file.but the problem is the html file already has its content..i want to append the new output to that html file..please suggest any new ideas…i m tryin to store the output in a textfile and append to that html file..but its nt workin..need ur help

Code:
while read LINE
do
echo $LINE | grep UCM | egrep ‘(Shutdown|Unavailable)’| tee HC_Report.txt
done
Source: The UNIX and Linux Forums