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 account to remove all advertisements.
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
Thread Tools | Display Modes |
|
||||
|
You would like to sort it based upon first character of each line?
__________________
Vivek Gite |
|
||||
|
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 Last edited by nixcraft; 2nd July 2009 at 01:46 PM. Reason: See below |
| The Following User Says Thank You to nixcraft For This Useful Post: | ||
jaysunn (27th June 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 |
|
|||
|
Quote:
|
| The Following User Says Thank You to cfajohnson For This Useful Post: | ||
nixcraft (2nd July 2009) | ||
|
||||
|
Quote:
__________________
Vivek Gite |
![]() |
|
|
| 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 | 6 | 6th September 2010 10:05 AM |
| Shell Script To change strings / text in a text file | jaysunn | Shell scripting | 1 | 8th May 2009 05:58 PM |
| Modify Text in a file | maxcell | Shell scripting | 3 | 25th October 2008 08:33 PM |
| rearranging columns in a text file | sureshbup | Shell scripting | 2 | 6th December 2006 09:43 AM |
| Replacing text in a file using awk | postyrus | Shell scripting | 4 | 2nd May 2005 03:31 PM |