Sponsored Content
Top Forums Shell Programming and Scripting Removing last character of a specific line from a file Post 302947270 by sang8g on Wednesday 17th of June 2015 02:54:30 AM
Old 06-17-2015
actually my requirement is that i should open the test.prop file and remove the last character ")" from a particular line and then save and quit the file. this should be done by a script itself.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

removing new line character

I'm appending header and trailer record for a binary file using echo "$header" > filename cat oldfilename >> filename echo "$trailer" >> filename The echo is introducing newline character after header and trailer.Please let me know is there any possibility to get rid of newline character. (2 Replies)
Discussion started by: ammu
2 Replies

2. UNIX for Dummies Questions & Answers

removing a character and addending to end in each line in a file

HI i am having a file this (sys19:pnlfct:/pfact/temp>) cat temp_sand 1234567890 1234567890 1234567890 1234567890 I want to make this file as (sys19:pnlfct:/pfact/temp>) cat temp_sand 1456789023 1456789023 1456789023 1456789023 just take the 2nd and 3rd position and put it... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies

3. Shell Programming and Scripting

Removing last character from each line of file

How can I remove the last character from each line of a file? This must be done without "funny" characters, as I want to transfer the code to/from Windows. Any ideas? (17 Replies)
Discussion started by: cjhancock
17 Replies

4. Shell Programming and Scripting

How to concat line first and then removing the ^M character

hi Someone can give me some clue or script in writing the below requirement I am having 5 or 10 files of unix files which contain ^M charactes. First we have to find ^M character and concat the line where it has broken and then we have to remove the ^M character from the uxix... (11 Replies)
Discussion started by: vsantoshusa
11 Replies

5. UNIX for Dummies Questions & Answers

Need help removing last character of every line if certain character

I need help removing the last character of every line if it is a certain character. For example I need to get rid of a % character if it is in the last position. Input: aaa% %bbb ccc d%dd% Output should be: aaa %bbb ccc d%dd I tried this but it gets rid of all of the % characters.... (5 Replies)
Discussion started by: raptor25
5 Replies

6. Shell Programming and Scripting

Removing first and last character of line

Hi all, Please help me to remove first and last character of each line in a file. Thanks, Baski (5 Replies)
Discussion started by: baskivs
5 Replies

7. Shell Programming and Scripting

Read file from nth line to specific character

Hi, I want to read the file from nth line (where n is an integer) to until I encounter @ char. Can any one please help me how to do this? Thanks. (3 Replies)
Discussion started by: laalesh
3 Replies

8. Linux

Removing a character at specific position in a column

Hi, I have a file like this (about 8 columns in total, this being the 2nd column) gi_49482297_ref_YP_039521.1_ gi_49482297_ref_YP_039521.1_ gi_49482315_ref_YP_039539.1_ gi_49482315_ref_YP_039539.1_I want to remove the _ at the end of the line. And at later stages I would want to replace the... (5 Replies)
Discussion started by: Syeda Sumayya
5 Replies

9. Shell Programming and Scripting

Insert character at specific location in a each line of the file

Hi All, I am trying to write a shell script where it should insert character 'I' in 180th position of each line(except first and last line) of the file. Below is the script for file in /home/test/bharat/*.RET do # Process file echo "File Name=" $file #l_fileName="${file##*/}" ... (19 Replies)
Discussion started by: bharath561989
19 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
RSRCE(1)							 Debian GNU/Linux							  RSRCE(1)

NAME
rsrce - editor for raw MacOS resource forks SYNOPSIS
rsrce [-e] [-f script] [-o output-file] [input-file] DESCRIPTION
Rsrce is a command driven Macintosh resource fork editor for Unix-like operating systems. It works with raw resource forks stored in Unix files, such as the .rsrc files produced by the macutil package. Rsrce doesn't allow you to edit the resource data directly. It only knows to import/export them from/to files, performing conversion for the few resource types it knows. OPTIONS
-e When this option is given, the failure of an editor command will cause rsrce to quit immediately with a non-zero exit status. This is similar to the -e option to /bin/sh. -f script Instructs rsrce to read its commands from the given script, instead of using the standard input. -o output-file Specifies a default output file for the writecommand. Useful when calling rsrce scripts which save their changes with a write com- mand without a filename. If an input-file is specified, it is loaded before rsrce starts reading commands, and is used as the default output file if the -o option has not been given. USAGE
Rsrce reads commands from the standard input. Unquoted whitespace is ignored, except for the purpose of separating arguments. Empty lines are ignored, and a # at a position where an argument would have started indicates a comment which extends to the end of the line. Text within single quotes is used as-is. An unquoted backslash can be used the way it works in C strings, or to force literal interpretation of the following character. Resources are referred to by specifing their type and id, separated by a colon. I mean, something like "STR#:128". If the given type has less than 4 letters, spaces are added to complete it. The following commands are available: read [file] read the resources from file write [file] write the resources to file create resource create a new, empty resource with the given type and id delete resource remove the specified resource rename resource new-name change the name associated with resource to new-name chattr resource attr-spec change the attributes of resource according to attr-spec ls list each resource's type, id, attributes, data lenght, and name hexdump resource show an hexdump of resource's data import|export resource file [ext] import/export resource's data from/to file. The conversion which is performed depends on the extension of the given filename. This extenstion may be overriden by providing the extargument. edit resource[ext] invoke an external editor to change resource's data help list available commands exit terminate rsrce (without saving, use write before exit if you wish to save your changes) CONVERSION OF RESOURCE DATA
When rsrce imports or exports resource data, a conversion can be performed depending on the resource type and the extension of the provided filename. The following extensions are known to rsrce: bin causes no conversion, the raw resource data is used regardless of the resource type; txt causes the resource data to be converted to plain text. This is possible for STR, STR#andCMDLresources. BUGS
Rsrce has only been originally created to change the configuration of the miBoot Linux bootloader for OldWorld PowerMac computers. Since I do not use MacOS, I haven't tested any other usage of this program. You should therefore be very careful when using it, as it could very well produce unusable output. Another consequence of this is wildly missing functionnality. I'm not going to work on it, since I couldn't test anything in a real situa- tion. Patches and/or usage reports would be very welcome. AUTHOR
Jeremie Koenig <sprite@sprite.fr.eu.org> SEE ALSO
hfsutils(1), macutil(1) Debian Project 2004-03-26 RSRCE(1)
All times are GMT -4. The time now is 03:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy