![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| return previous line for pattern match | braindrain | UNIX for Dummies Questions & Answers | 4 | 12-08-2008 05:17 PM |
| how to go previous line in vim | useless79 | UNIX for Advanced & Expert Users | 2 | 09-16-2007 08:10 AM |
| replace [previous] line | grossgermany | Shell Programming and Scripting | 10 | 07-29-2007 09:40 AM |
| search and retrieve previous line in file | paulsew | Shell Programming and Scripting | 2 | 02-23-2007 08:04 AM |
| Return status of all previous runs | mpang_ | Shell Programming and Scripting | 4 | 06-27-2006 02:58 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
return the previous line
Hello friends ,
I am doing the following command, but it is not wise to all files. Code:
for temp in `find ./CSV/ -name "*.txt"`
do
sed -n -e 'N; /*Main End/p' $temp
done
I mean some files contains the string *Main End , But it wont return me any value . But In some files it contains the exact *Main End pattern , it returns me the previous line as usual. Pls help.. I am using Solaris 6.0 |
|
||||
|
I think you misunderstand /*Main End/ as a regex.
Code:
/Main End$/ = Main End at the end of a line /.*Main End/ = one or more of any character before Main End occurs could be in the middle or at the end |
|
||||
|
Quote:
But I opened in vi editor . And when I looked with the vi option set list. It seems to be both same . Ok. can you Please suggest me a R.E here for search the below starting with a * follwing Main End. Thank you in advance.. |
|
||||
|
Strange output
Quote:
file1 Code:
*Comment Frame 641 at 666.667 us 000000,CB1F,0,0,0,0,1,0,1 *Main End Code:
000000,0000,0,0,2,0,0,0,0 *Comment Frame 5,7E3D,0,0,0,0,1,0,1 *Main End Code:
sed -n -e 'N; /\*Main End/p' file1 But it wont But in case of file2 its working , Please need help urgently.. Last edited by user_prady; 12-18-2007 at 01:18 AM.. |
|
||||
|
Quote:
I am afraid, It wont return anything either of these.. I need only the previous line.. |
![]() |
| Bookmarks |
| Tags |
| linux, linux commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|