Sponsored Content
Full Discussion: Name directories with "0s"
Top Forums UNIX for Dummies Questions & Answers Name directories with "0s" Post 302713761 by elixir_sinari on Thursday 11th of October 2012 09:00:19 AM
Old 10-11-2012
Quote:
Originally Posted by pamu
try something like this..


Code:
 for i in {1..1000}
 do
 dir_name=$(echo $i | awk '{ printf "%04d",$0}{print ""}')
 mkdir "$dir_name"
 mv files "$dir_name"
 done

You forget that there is an external command/shell built-in called printf, too.
So, that's a useless use of awk. Smilie

Last edited by elixir_sinari; 10-11-2012 at 10:11 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
MYSQL_CLIENT_TEST(1)					       MySQL Database System					      MYSQL_CLIENT_TEST(1)

NAME
mysql_client_test - test client API mysql_client_test_embedded - test client API for embedded server SYNOPSIS
mysql_client_test [options] [test_name] ... mysql_client_test_embedded [options] [test_name] ... DESCRIPTION
The mysql_client_test program is used for testing aspects of the MySQL client API that cannot be tested using mysqltest and its test language. mysql_client_test_embedded is similar but used for testing the embedded server. Both programs are run as part of the test suite. The source code for the programs can be found in in tests/mysql_client_test.c in a source distribution. The program serves as a good source of examples illustrating how to use various features of the client API. mysql_client_test is used in a test by the same name in the main tests suite of mysql-test-run.pl but may also be run directly. Unlike the other programs listed here, it does not read an external description of what tests to run. Instead, all tests are coded into the program, which is written to cover all aspects of the C language API. mysql_client_test supports the following options: o --help, -? Display a help message and exit. o --basedir=dir_name, -b dir_name The base directory for the tests. o --count=count, -t count The number of times to execute the tests. o --database=db_name, -D db_name The database to use. o --debug[=debug_options], -#[debug_options] Write a debugging log if MySQL is built with debugging support. The default debug_options value is 'd:t:o,/tmp/mysql_client_test.trace'. o --getopt-ll-test=option, -g option Option to use for testing bugs in the getopt library. o --host=host_name, -h host_name Connect to the MySQL server on the given host. o --password[=password], -p[password] The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, you are prompted for one. o --port=port_num, -P port_num The TCP/IP port number to use for the connection. o --server-arg=arg, -A arg Argument to send to the embedded server. o --show-tests, -T Show all test names. o --silent, -s Be more silent. o --socket=path, -S path The socket file to use when connecting to localhost (which is the default host). o --testcase, -c The option is used when called from mysql-test-run.pl, so that mysql_client_test may optionally behave in a different way than if called manually, for example by skipping some tests. Currently, there is no difference in behavior but the option is included to make this possible. o --user=user_name, -u user_name The MySQL user name to use when connecting to the server. o -v dir_name, --vardir=dir_name The data directory for tests. The default is mysql-test/var. COPYRIGHT
Copyright (C) 2006, 2013, Oracle and/or its affiliates. All rights reserved. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Oracle Corporation (http://dev.mysql.com/). MySQL 01/23/2014 MYSQL_CLIENT_TEST(1)
All times are GMT -4. The time now is 11:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy