![]() |
|
|
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 |
| URL call from SHELL script | chengwei | Shell Programming and Scripting | 37 | 04-15-2009 10:52 PM |
| Call shell script from php not run ? | raccsdl | Shell Programming and Scripting | 2 | 11-19-2007 08:21 AM |
| how can i call a shell script from pl/sql | rajesh.P | Shell Programming and Scripting | 3 | 09-17-2007 12:09 AM |
| how can a call shell script from pl/sql | rajesh.P | UNIX for Dummies Questions & Answers | 0 | 09-14-2007 03:42 AM |
| How to call a shell script from awk ? | Amruta Pitkar | Shell Programming and Scripting | 1 | 04-20-2007 05:35 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to call last 14 characters with grep/sed in shell script.
Hi. This is my first post on the forums.
I am trying to write a script that will parse a folder of files "oneverylongfilenamexyz.pdf" and create a .dat file named "oneverylongfilenamexyz.dat" with the first line of each .dat file saying variable="xyz" where xyz is the last 14 characters of $i before the extension. My syntax is very poor but I think the logic should be something like # first loop to make dat files for i in `ls -R dat_tmp/ | grep .pdf` touch $i.dat # second loop to fill dat files for i in `ls -l | grep .dat` echo 'variable=`sed[last 14 characters] $i`' > $i.dat Any help is much appreciated. Thank you. Last edited by attonbitusira; 06-08-2009 at 05:12 PM.. Reason: made some progress |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|