unix - Conditional creation of file from existing files -


i have requirement here: shell script having multiple files process , suppose if having data file in following format:

h:asdsa_20110221010224_0018020110221010224asdfdgda         qweeret 11594          1              xxct5                                             500            1                                          11594          1              xxct5                                             500            1               t:2           or   11594          1              xxct5                                             500            1                                          11594          1              xxct5                                             500            1      

i need create new file out of above data files based on following condition: a. if data file having first line starting h: , last line ending t:, new file should be(without row starting h: , t):

1

1594          1              xxct5                                             500            1                                          1594          1              xxct5                                             500            1   

b. if data file not having h: , t: in begining , end of data file, new file should be(without row starting h: , t):

11594          1              xxct5                                             500            1                                          11594          1              xxct5                                             500            1   

please me appropriate solution.

thanks, arun

this may want.

sed '1{/^h/d};${/^t/d}' inputfile 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -