![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script for pulling words of 4 to 7 characters from a file | Azeus | Shell Programming and Scripting | 2 | 12-07-2008 02:56 PM |
| script to convert words into links | kazordoon | Shell Programming and Scripting | 9 | 08-03-2008 12:33 PM |
| Script to find all the files that contain any of the words present in another file | tsanthosh | Shell Programming and Scripting | 4 | 05-21-2008 03:29 AM |
| Bash script pass sentence in block | katrvu | Shell Programming and Scripting | 6 | 02-11-2008 11:04 AM |
| how to find capital letter names in a file without finding words at start of sentence | kev269 | Shell Programming and Scripting | 1 | 04-10-2006 10:35 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||||
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|
|||||
|
Need help in script; [ script/s to control a sentence & its words ]
Hello friends,
Thanks very much for the support. Sorry for the confusion. Explaining the situation with a sample case Input is a sample text containing a if block as follows HTML Code:
10 20 30 40
1 * * * * 50 Columns- just assume
1 statements .......
2 if ( condition
3 )
4 {
5 Statement 1;
6 Statement 2;
7 Statement 3;
8 }
9 statements ..............
10
10 20 30 40
1 * * * * 50 Columns- just assume
1. Bring the Closing bracket of if statement from LINE 3 to to end of LINE 2 as follows HTML Code:
10 20 30 40
1 * * * * 50 Columns- just assume
1 statements .......
2 if ( condition )
3
10 20 30 40
1 * * * * 50 Columns- just assume
HTML Code:
10 20 30 40
1 * * * * 50 Columns- just assume
5 Statement 2;
6 Statement 3;
7 }
8 statements ..............
10 20 30 40
1 * * * * 50 Columns- just assume
HTML Code:
10 20 30 40
1 * * * * 50 Columns- just assume
1 statements .......
2 if ( condition ) {
3 Statement 1;
10 20 30 40
1 * * * * 50 Columns- just assume
HTML Code:
10 20 30 40
1 * * * * 50 Columns- just assume
3
4 Statement 1;
5 Statement 2;
6 Statement 3;
7
10 20 30 40
1 * * * * 50 Columns- just assume
HTML Code:
10 20 30 40
1 * * * * 50 Columns- just assume
1 statements .......
2 if ( condition ) {
3
4 Statement 1;
5 Statement 2;
6 Statement 3;
7
8 }
9 statements ..............
10
10 20 30 40
1 * * * * 50 Columns- just assume
![]() <space> meant tab space, i am a beginner & just got comfortable with sed & awk...well, i am ready to have keys to the new doors..so please do provide any new or better methods to solve the problem. Summary If possible it will be nice if i can get a script, that can do the following. so that i can have a start. 1. finds the position of the first word in a line. >for example the script should be able to tell me the position of A in A11 BBB CC1 2. finds the position of the last word in a line (calculating 1st character position of the first word of a line) > for example the script should be able to tell me the position of '2' in B11 DDD ZZ2 (calculating last character position of the last word of a line) 3. A script that can move any word say B11 to a position after CC1 (line to line movement) 4. A script that can move any word say RRR such that the A11 & RRR should start from same column (column to column movement) HTML Code:
Before
A11 BBB CC1
B11 DDD ZZ2
RRR FFF
After
A11 BBB CC1 B11
DDD ZZ2
RRR FFF
![]() ![]() Last edited by frozensmilz; 01-22-2009 at 10:12 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|