Search Results

Search: Posts Made By: kashif.live
1,614
Posted By kashif.live
ok guys. thanks alot. got answer: sed 1d...
ok guys. thanks alot. got answer:

sed 1d filename | while read -a words
do

ip_address="${words[0]}"
echo $ip_address
hostName="${words[1]}"
echo $hostName
pLocation="${words[2]}"
echo...
1,614
Posted By kashif.live
@Jotne: thank, this fullfil my initail...
@Jotne: thank, this fullfil my initail requirement but when i have multiple lines then it doesn't work.

@zaxxon: requirement in this case is different than previous one. Now I 've values in...
1,614
Posted By kashif.live
Reading a text file using bash
I've a file in linux with following text:
;ip address hostname put-location alt-put-location tftpserver
192.168.1.1 r01-lab1-net /mnt/nas1/fgbu/ ...
1,490
Posted By kashif.live
Comparison of two file using bash scripting
I need following code in linux bash:


Step 1:


run a command and create file1

run a command and create file2


compare file1 and 2

if any difference go to step 1 (keep...
2,130
Posted By kashif.live
Search words in a line and print next 15 lines.
I have a text file ( basically a log file) and i have 2 words (alpha, beta),

Now i want to search these two words in one line and then print next 15 lines in a temp file. there would be many...
2,287
Posted By kashif.live
@Scrutinizer: Tried "" when sourcing file but no...
@Scrutinizer: Tried "" when sourcing file but no success.
2,287
Posted By kashif.live
1. I also tried using "". but I got same issue. ...
1. I also tried using "". but I got same issue.
2. Command is not spread over 2 line. in CentOS it is just one line.
3. I tried using without array, loop and values (as given below) but again no...
2,287
Posted By kashif.live
sendEmail: Script and Array
I have a script that send email using sendEmail (CentOS shell)
script is:

sendEmail -vvv -u "TestCompany, Inc.: USB Added" -f user@domain.com -t To@domain.com -s ASPMX.L.GOOGLE.com -m "USB...
8,556
Posted By kashif.live
@Thanks Corona688: This script is working fine on...
@Thanks Corona688: This script is working fine on linux CentOS. but when i moved it to ubuntu then i get following error:

Bad substitution

and this error is for following line:

done < ...
8,556
Posted By kashif.live
@Corona688: Thanks for your reply. I have...
@Corona688: Thanks for your reply.

I have written this code to read values form config file and then use them at later stage in an array. Kinldy review it and suggest if I'm not doing extra.
...
5,856
Posted By kashif.live
while loop error. (command not found)
can any1 please tell me what is problem with following code:

i=1;
cat test| while read CMD;
do
Var$i=$CMD; or Var$i=$(echo $CMD) ;
let i++
doneI keep getting error :
...
8,556
Posted By kashif.live
Read values from file.
I have a config file of this format:

Company= Alpha Tech
From Email = AlphaTech@Alphatech.com
Pass = Passowrd
To Email = abc@hotmail.com
Smtp=smtp.live.com:587

I want to read these values...
2,334
Posted By kashif.live
if condition error: integer expression expected
I am trying to run following condition with both variables having numeric values "1,2,3"

if [ '$NEW_STATE' -gt '$OLD_STATE' ];when i run it i get following error:



$NEW_STATE:...
4,313
Posted By kashif.live
if criteria means number of words change in a...
if criteria means number of words change in a line then i wud say 4 or less. if more than that then output that line.
4,313
Posted By kashif.live
So far I'm using following command to get...
So far I'm using following command to get difference of Newfile

grep -vxFf oldfile newfileoldfile:weather is pleasant
I am happynewfile:
weather is pleasant
I am happy
it is raining...
1,254
Posted By kashif.live
script executes some time but not always.
I have following script to send email when a USB is attached.

#!/bin/bash

NUMBER=`/bin/cat /u/numberoflines`
LINES=`/usr/bin/wc -l < /var/log/messages`

DIFFERENCE=$(($LINES-$NUMBER))

if...
12,380
Posted By kashif.live
@Scrutinizer: can you please explain what is...
@Scrutinizer: can you please explain what is "IFS" in this loop.is it the string that I'm trying to search? and why i need text.out? can't i go without it? and sorry If my question wasn't clear...
12,380
Posted By kashif.live
@Scrutinizer...
@Scrutinizer (https://www.unix.com/members/302052697.html): sorry, you didn't get my point.
I know tail -f or tailf can be used to read from some file but i want to put that thing in if condition....
12,380
Posted By kashif.live
@ Corona688: thanks for reply. but in my case i...
@ Corona688: thanks for reply. but in my case i can't use udev as it is not allowed to be dependent on it. for me there are 2 ways to check it. one write perl code ( which I can't as I know nothing...
12,380
Posted By kashif.live
How to read a dynamically changing file
I want to read a constantly changing file and do some operation on text found in that file.
Actually that is log file of linux system and whenever i find a matching string in that file i want to...
1,909
Posted By kashif.live
@methyl. yes you got it right. it is counting...
@methyl. yes you got it right. it is counting words in file ed. and grep command is sending difference of files ud and uc to ed. if there is any difference found then it will do some operataion. but...
1,909
Posted By kashif.live
Hi again when i try to use this command, it...
Hi again

when i try to use this command, it works perfect:


while [ "$(fdisk -l /dev/disk/by-path/*usb* | wc -w)" -ne 0 ]

but when i try to use this command in while loop i get nothing
...
1,909
Posted By kashif.live
actually this is part of a complete program in...
actually this is part of a complete program in which i need to shoot an email when a usb is connected and when a usb is disconnected with proper information of usb.

yes df -h shows all drives but...
1,909
Posted By kashif.live
actually I m trying to check if there is any usb...
actually I m trying to check if there is any usb connected or not. if usb device is connect then fdisk will give me alot of information so i just decided to see if wc is zero then it will send email...
1,290
Posted By kashif.live
thanks @zedex. its working.
thanks @zedex. its working.
Showing results 1 to 25 of 34

 
All times are GMT -4. The time now is 05:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy