Sponsored Content
Top Forums Shell Programming and Scripting usr/bin/ls: 0403-027 The parameter list is too long Post 302329510 by kshji on Sunday 28th of June 2009 01:17:06 PM
Old 06-28-2009
No need to use ls in for, because shell file generation can do it. Filegenaration is handled by shell, not by command (*, ?, ...). Maybe number of arguments is not problem for shell. If it's, then you need tmp-file.

This version try to use shell built-in commands = much faster as use external commands like awk, sed, ...

If I understood your needs, here is version N. Works with ksh, bash, posix-sh, ...
Code:
cd /$ROOTDIR/scp/inbox/
# no need to count number of files, it can be 0, no problem, but we must check it
for gfile in PNT.2*
do
  [ "$gfile" = "PNT.2*" ] && break # no files, break the for loop
  # read 1st line from file
  read gline < $gfile
  # substr without awk help, using shell built-in properties
  x=${gline:58:1} # 1st char index is 0
  # and if you like to run faster then no need in this case to use elif
  # if it's true, do it and continue = skip to the next value
  filename=${gfile:0:28}
  if [ "$x" -eq "0" -o "$x" -eq "1" ]; then
        mv /$ROOTDIR/scp/inbox/$filename /$ROOTDIR/scp/inbox/string1/$filename
        continue
  fi
  if [ "$x" -eq "2" -o "$x" -eq "3" ]; then
        mv /$ROOTDIR/scp/inbox/$filename /$ROOTDIR/scp/inbox/string2/$filename
        continue
  fi
  # you can write also
  [ "$x" -eq "4" -o "$x" -eq "5" ] && mv /$ROOTDIR/scp/inbox/$filename /$ROOTDIR/scp/inbox/string3/$filename && continue
  [ "$x" -eq "6" -o "$x" -eq "7" ] && mv /$ROOTDIR/scp/inbox/$filename /$ROOTDIR/scp/inbox/string4/$filename && continue
done

In this example maybe case is the most beautiful (my opinion).
Code:
...
   case "$x" in
      0|1) mv ... ;;
      2|3) mv ... ;;
      ...
      *) ;; # default = what is this ?
   esac
...

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep 0403-027 The parameter list is too long.

Hi there I get this error message when I try to do a basic grep. Does anyone have any ideas what is wrong. Thanks 0403-027 The parameter list is too long. (1 Reply)
Discussion started by: japada
1 Replies

2. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies

3. Shell Programming and Scripting

ksh: /bin/grep: arg list too long

when i run the command below in a directory which contains too many files i got the error: ksh: /bin/grep: arg list too long ls|grep AA*B* how can i handle this problem? (5 Replies)
Discussion started by: gfhgfnhhn
5 Replies

4. UNIX for Dummies Questions & Answers

ksh: /usr/bin/ls: arg list too long

I am using IBM AIX unix version 4.3.3.0. In a directory there are many files with different patterns. When I am trying to execute the command, ls -l with the file pattern, which have fewer files it gives the desired result. However when I am trying to execute the same command for file pattern,... (2 Replies)
Discussion started by: jitindrabappa
2 Replies

5. UNIX for Dummies Questions & Answers

0403-027 The parameter list is too long.

hi when i ran the following command rm *_F i got this error 0403-027 The parameter list is too long. It shd remove 5000(around) files pls help me on this. why its throwing this error how to rectify this error (5 Replies)
Discussion started by: romiljain
5 Replies

6. Shell Programming and Scripting

/usr/bin/ls: 0403-027 the parameter list is too long.

Hi, I'm trying to list specific files and redirecting to a file ls aqp* > temp.lst but getting "/usr/bin/ls: 0403-027 the parameter list is too long." error. I just have 236 files in the directory. I tried "ls | grep 'aqp*' > temp.lst" too, but nothing was redirected. + grep aqp* +... (4 Replies)
Discussion started by: dateez
4 Replies

7. UNIX for Dummies Questions & Answers

UNIX: 0403-027 The parameter list is too long

Hello All, We have a batch job that clean old records. This run a script to back up file then delete. Unfortunately, this job been failing lately. This is the error we received. "/usr/bin/compress: 0403-027 The parameter list is too long." I am not sure if the job failed since its... (2 Replies)
Discussion started by: juieshenkei
2 Replies

8. AIX

aix:ksh: /usr/bin/rm: 0403-027 The parameter list is too long.

Hi, I am getting the below error message When i am trying to delete the files from the directory.Could you please guide me? rm *.aud ksh: /usr/bin/rm: 0403-027 The parameter list is too long. and find /oracle/admin/testP/adump/*.aud -mtime +5 -exec rm {} \; ksh: /usr/bin/find:... (3 Replies)
Discussion started by: nokiae63
3 Replies

9. AIX

0403-027 The parameter list is too long on AIX 5.3

Hi we are using AIX 5.3 64bit I have near about 79000 log file having naming convention like "IFTMBCSun Aug 14 07:45:00 PAKST 2011". This naming convention was created by a script error, now we need to rename these log file by removing extar spaces and (:) colon for that we wrote below script ... (4 Replies)
Discussion started by: lodhi1978
4 Replies
mhpath(1mh)															       mhpath(1mh)

Name
       mhpath - print full pathnames of MH messages and folders

Syntax
       mhpath [ +foldername ] [ msgs ] [ -help ]

Description
       Use the command to display the full pathname of the specified folder.  If you do not specify a folder, displays the pathname of the current
       folder.

       If you specify a message with its message number, displays the pathname of the specified message.  You can also specify a  number  of  mes-
       sages,  or  a range of messages.  If the top of the range that you specify is greater than the last message in the folder, displays as much
       of the specified range as possible.

       Additionally can take a keyword or a sequence name.  The following keywords are acceptable:

       first	 The first message in the folder.

       last	 The last message in the folder.

       new	 The message after the last message in the folder.  You cannot use new as part of a message range.

       cur	 The current message in the folder.

       prev	 The message before the current message.

       next	 The message after the current message.

       all	 All of the messages in the folder.

Options
       -help	 Prints a list of the valid options to this command.

Examples
       In the following example, displays message 3 in the folder
       % mhpath +inbox 3
       /r/phyl/Mail/inbox

       The following example displays the pathname of messages 2 to 5 in the current folder:
       % mhpath 2-5
       /r/phyl/Mail/inbox/2
       /r/phyl/Mail/inbox/3
       /r/phyl/Mail/inbox/4
       /r/phyl/Mail/inbox/5

Profile Components
       Path:   To determine your Mail directory

Files
       The user profile.

See Also
       folder(1mh)

																       mhpath(1mh)
All times are GMT -4. The time now is 08:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy