I want my desired output to be as below, coz im just trying to get the files for the date im passing through the first FOR loop (20131202, 20131203 & 20131204)
The code at the bottom is a simplified example of what we have.
If I use the following:
&& echo "echo failed"
$? returns 1
When I use
if ; then echo "echo failed" ; fi
$? returns 0
Does anyone know what's wrong with this?
Using AIX 6.1 and KSH
for NUM in 1 2 3
do
... (5 Replies)
Hi,
i have a problem with this script:
for i in $(cat list_ip_switch)
do
if
if ; then
echo "found ip"
else
echo "not found ip"
fi
done
cat list_ip_switch
10.155.249.171
10.155.249.172 (3 Replies)
Hi i have to cut columns 2 to 6 from a file and assign it to arrays ,
The following code works
for ctcol in 2 3 4 5 6;
do
set -A a$ctcol $(cut -d, -f $ctcol test_file)
done
how ever this does not work
for ctcol in {2..6};
do
set -A a$ctcol $(cut -d, -f $ctcol test_file)... (4 Replies)
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
... (2 Replies)
I want to get newvar outside the while
any ideas?
while read myline; do
var=${myline}
newvar1=$(let "$var")
done
echo $newvar1
I found it its ok now Thank you! (0 Replies)
can some one please tell me what is the problem with my syntax:confused:
I have 100 files in one folder
1. want to read each of the line by line
2. calculate their number of the words between the first word and the last word of each line
3. create file for each file with number of words... (8 Replies)
Below is my script that is using to rename the name of file .Here I am using two methods to pass the both arguments wih script name or run the script and give the input one by one.But my issue is I want to rename the name of the file if user select Y(y) then it should rename the file else select... (4 Replies)
spath="/home/user/k/${1}"
dpath="/home/user/seq/Nov17/${1}"
cd $dpath
ls -1 $spath > list
c=1
while read list
newlist=`echo $list | sed 's/.gz//' `
newnewlist=`echo $newlist | sed 's/.fastq//' `
do
echo $c
echo $list
c=$(($c+1)) (6 Replies)
Hi All,
I've written a script to read 2 files and compare the contents using while loop but somehow when $line is not found in test2, the script will continue looping.
Below is my code, pls advise what could went wrong
TIA
Nick
for line in test1.txt | while read line
do
grep -i... (4 Replies)
I need to process a dirtree containing ms office files such that each file is stored as a variable and also, just the file file stem. Why? They will be using as input and output parameters for another script. For example /path/to/second_script -i filename.docx -o filename
Here's what I... (1 Reply)