Linux / UNIX Tech Support Forum
This is a discussion on Alphabetize text within a file within the Shell scripting forums, part of the Development/Scripting category; Hello Forum people. I have been searching the Internet for the answer to my question, and I think it may ...
|
Register free or login to your existing account and remove all advertisements. |
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
You would like to sort it based upon first character of each line?
__________________
Vivek Gite Linux Evangelist |
|
||||
|
Hey Nixcraft,
Thanks for the quick reply. Yes my goal would be to alphabetize each string in the file in alphabetical order. e.g. Code:
ehqukldkg hiuthhhtilc Code:
dehkklqu chhhhhiiltu Thanks as always for your forum and professionalism. Jaysunn |
|
||||
|
Try the following:
PHP Code:
Quote:
__________________
Vivek Gite Linux Evangelist Last edited by nixcraft; 07-02-2009 at 02:46 PM. Reason: See below |
| The Following User Says Thank You to nixcraft For This Useful Post: | ||
jaysunn (06-27-2009)
| ||
|
|||
|
Quote:
Quote:
Quote:
|
|
||||
|
Quote:
Code:
INPUT="this is a test.txt" [ ! -f "$INPUT" ] && echo "No" || echo "Yes" Code:
>"$INPUT" [ ! -f "$INPUT" ] && echo "No" || echo "Yes" And with empty Code:
INPUT="" [ ! -f "$INPUT" ] && echo "No" || echo "Yes" Tested on GNU bash, version 3.2.39.
__________________
Vivek Gite Linux Evangelist |
|
|||
|
Quote:
|
| The Following User Says Thank You to cfajohnson For This Useful Post: | ||
nixcraft (07-02-2009)
| ||
|
||||
|
Quote:
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| linux sort each character , shell scripting , shell sort each character , sort , sort each character shell , tr command , unix sort each character |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To find and replace in text file | nashtech | Shell scripting | 5 | 01-31-2010 07:32 AM |
| Shell Script To change strings / text in a text file | jaysunn | Shell scripting | 1 | 05-08-2009 06:58 PM |
| Modify Text in a file | maxcell | Shell scripting | 3 | 10-25-2008 09:33 PM |
| rearranging columns in a text file | sureshbup | Shell scripting | 2 | 12-06-2006 10:43 AM |
| Replacing text in a file using awk | postyrus | Shell scripting | 4 | 05-02-2005 04:31 PM |