Jump to content

shell command


mousho

Recommended Posts

hi friends

i have a sort problem that stop work for me and i try everyhing already and its not working

i'm trying to sort the txt file by the place of 8 letter in the file

 

(command "_.Shell" 	(strcat "sort /+8 <" "C:\Autocad Lisp\mpdlist.txt" ">" "C:\Autocad Lisp\newlist.txt"))
  

or

(command "_.Shell" 	(strcat "sort /+8 <" "C:\\Autocad Lisp\\mpdlist.txt" ">" "C:\\Autocad Lisp\\newlist.txt"))

 

few years ago it did work :(

 

mpdlist.txt

Link to comment
Share on other sites

7 hours ago, mousho said:

hi friends

i have a sort problem that stop work for me and i try everyhing already and its not working

i'm trying to sort the txt file by the place of 8 letter in the file

 

(command "_.Shell" 	(strcat "sort /+8 <" "C:\Autocad Lisp\mpdlist.txt" ">" "C:\Autocad Lisp\newlist.txt"))
  

or

(command "_.Shell" 	(strcat "sort /+8 <" "C:\\Autocad Lisp\\mpdlist.txt" ">" "C:\\Autocad Lisp\\newlist.txt"))

 

@mousho The 2nd option worked fine for me. It has to be the 2nd version because you MUST use the "\\" to create the single "\" in the actual shell command. Make sure the path exists and everything is spelled correctly. I used the following in my test:

(command "_.Shell" (strcat "sort /+8 <" "C:\\Temp\\mpdlist.txt" ">" "C:\\Temp\\newlist.txt"))

Results:

%%17410   1L=520          2  1    1398       
%%17410   2L=747          2  1    1398       
%%17410   3L=1198         2  1    1398       
%%174 8   4L=954          2  1    1398       
%%174 8   5L=520          2  1    1398       
%%17410   6L=520         14 15  200399       
%%17412   7L=747         14 15  200399       
%%17412   8L=1198        14 15  200399       
%%174 8   9L=954         14 15  200399       
%%174 8  10L=520         14 15  200399  

 

Edited by pkenewell
  • Like 1
Link to comment
Share on other sites

10 hours ago, pkenewell said:

 

@mousho The 2nd option worked fine for me. It has to be the 2nd version because you MUST use the "\\" to create the single "\" in the actual shell command. Make sure the path exists and everything is spelled correctly. I used the following in my test:

(command "_.Shell" (strcat "sort /+8 <" "C:\\Temp\\mpdlist.txt" ">" "C:\\Temp\\newlist.txt"))

Results:

%%17410   1L=520          2  1    1398       
%%17410   2L=747          2  1    1398       
%%17410   3L=1198         2  1    1398       
%%174 8   4L=954          2  1    1398       
%%174 8   5L=520          2  1    1398       
%%17410   6L=520         14 15  200399       
%%17412   7L=747         14 15  200399       
%%17412   8L=1198        14 15  200399       
%%174 8   9L=954         14 15  200399       
%%174 8  10L=520         14 15  200399  

 

thx i found that there is a problem with the space in the folder name, the program dont know how to treat with space bar 

 

Link to comment
Share on other sites

14 hours ago, mousho said:

thx i found that there is a problem with the space in the folder name, the program dont know how to treat with space bar 

@mousho I figured it out. You need to add embedded quotes into the path arguments using a double quote preceded with the backslash on each end of the parts (i.e. \"):

(command "_.Shell" (strcat "sort /+8 <" "\"C:\\Temp\\mpdlist.txt\"" ">" "\"C:\\Temp\\newlist.txt\""))

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...