10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi All
I have a source file named ABC-20150613 to 20150613.zip. I was trying to execute the below command on this source file, but its telling file is not available in that path and giving me some random file names.
ls -ltr| for z in ABC-????????*to*????????*.zip
do unzip $z -d
done
I... (5 Replies)
Discussion started by: ginrkf
5 Replies
2. Shell Programming and Scripting
I am searching a file and not able to escape a space if $i has a space in the name. I tried escaping it with a \ and also trying to add it to allow for spaces in the search. Neither are correct as the first awk only outputs path and the second awk doesn't run. Thank you :).
first awk
awk... (3 Replies)
Discussion started by: cmccabe
3 Replies
3. Shell Programming and Scripting
Hi,
I am having a file say list1 with a output like below
jun 12 18:23
may 20 18:23
Now i want to pass the above two values into for loop,I have written a script like this.
#!/bin/bash
a=`cat list1`
for i in $a
do
echo "HI $i"
done
expected output:
HI jun 12 18:23 (3 Replies)
Discussion started by: sumanthupar
3 Replies
4. Shell Programming and Scripting
This is a bit off the wall, but I often need to run scripts where there are argument values that contain special characters.
For example,
$ ./process.exe -t M -N -o temp.mol.s -i ../molfiles/N,N\',N\'\'-trimethylbis\(hexamethylene\)triamine.mol && sfile_space_to_tab.sh temp.mol.s temp.s
It... (1 Reply)
Discussion started by: LMHmedchem
1 Replies
5. Shell Programming and Scripting
How do I loop thru space separated values in a variable?
I hate to use very complicated counter increment logic for this kind of simple problem.
Expected result(using ksh)
$>echo "aaa bbbb cccc" | <looping code here>
var=aaa
var=bbbb
var=cccc
$>echo "aaa bbbb cccc" | while IFS=" "... (12 Replies)
Discussion started by: kchinnam
12 Replies
6. Shell Programming and Scripting
Hi Everyone!
I want to build sql inserts from a list of countries/regions saved in a file. The list looks like this:
United Kingdom
Czech Republic
...
The script I run is:
while read i;
do
var=`expr $var + 1`;
echo "INSERT INTO calltypes VALUES($var, '$i','$i');" >>... (5 Replies)
Discussion started by: linuca
5 Replies
7. Shell Programming and Scripting
The following statement does work. But the second command does not work as expected.
ssh root@123.123.123.123 \\"mysqldump -h localhost -u root -pPassWord dbName -d | gzip -cf\\" | gunzip -c > database1.sql
ssh root@123.123.123.123 \\"mysqlbinlog /var/log/mysql/mysql-bin.*... (0 Replies)
Discussion started by: shantanuo
0 Replies
8. Shell Programming and Scripting
for cmdopts in $*;do
case $cmdopts in
-mode)
mode="$2";shift 2
;;
-server)
server="$2";shift 2
;;
-Id)
Id="$2";shift 2
;;
-passwd)
passwd="$2";shift 2
;;
-rmtDir)
rmtDir="$2";shift 2
;;
-lcDir)
... (9 Replies)
Discussion started by: pinnacle
9 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I am trying to query the database to get the list of portfolio and for each portfolio, I am using the for loop, but the problem is some of the portfolio is having the spaces.
The Code
PORT=`${EFG_ISQL} -b <<-!
set nocount on
use ${EFG_DB}
go
select portId from PORTFOLIO
go... (3 Replies)
Discussion started by: peter35james
3 Replies
10. Shell Programming and Scripting
Hi All
I need to put a bunch of specific files in a directory (with loads of other files), into a tar archive. The best way I thought of doing this was putting the filenames into a file, reading them line by line in a for loop, and then adding them to a tar acrhive.
However the filenames have... (6 Replies)
Discussion started by: saabir
6 Replies