Put a string to the beginning of a file without a linefeed
Hello,
I need to put the following string to the beginning of a file - but it should not create a newline at the end of the string.
So, the file I have is a compressed one - with gzip.
And I would like to add an ASCII-String to the beginning of the file. The string has a length of 69 characters. For example:
So, what I need is the following as example:
I tried to do it with a sed - I found with Google, but unfortunately a sed -i ... does not work, because the option -i is not supported...
Do you have any other solution?
Last edited by rbatte1; 09-18-2014 at 10:00 AM..
Reason: Changed ICODE tags to just CODE tags
If you edit the file and insert this, how will the file be unzipped later? gunzip will expect the content in specific locations that it controls and I would not rely on the extracted files. How would you expect gunzip to deal with this extra data?
What's the overall intention? Are you trying to edit the content of one of the zipped files somehow?
By the way, my intention to do this is to have a header for the delivery protocol - within this header (the ascii string) are infos for the delivery tool (i.e. the recipient). When the recipient will get this file, before the uncompressing he has to delete the header first...
Hi there,
i need some help to remove all occurrences of a certain character at the beginning of a string.
Example: my string is 00102030 and i want to remove all zeros from beginning of string so the result is 102030 (3 Replies)
I'd like to copy strings from a log file and put them into a CSV.
The strings could be on different line numbers, depending on size of log.
Example Log File:
File = foo.bat
Date = 11/11/11
User = Foo Bar
Size = 1024
...
CSV should look like:
"foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Suppose, I have a variable var=" name is ".
I want to remove the blank spaces from the begining and endonly, not from the entire string.
So, that the variable/string looks like following
var="name is".
Please look after the issue. (3 Replies)
Hi,
I am trying to remove spaces from the beginning of a string (which i am using in my shell script). For ex - my string looks like this -
" no rows selected"
and i want the string to look like this -
"no rows selected"
How can i achieve this?
Thanks! (18 Replies)
Hi,
I have file a.txt as below. I want to add one string root beginning of each line.
Sample file a.txt
aaa
bbb
ccc
Sample output
Root aaa
Root bbb
Root ccc
Can any one help me on this? (6 Replies)
Hi,
I have a string like this user can specify different query sets that is why "or" is mentioned:
$string="](";
or
$string="]((";
or
$string="](((";
or
$string="]((((("; (1 Reply)
hi all!
i have a working that looks like this...
file1
MALE JOHN
MALE ANJO
FEMALE ANNE
MALE JAMES
FEMALE HONEY
FEMALE IZA
what i want to do is insert "M" when the first string is "MALE" and insert "F" when the first string is "FEMALE".
file1
M MALE ... (10 Replies)
I have a file in which I need to remove all newline characters but only if they are preceded by "^C" ( ASCII value 3 )
Basically this is a bulk copy file with "^B" and "^C" as delimiters for each record. The application producing the file is also appending a newline which I need to remove,... (1 Reply)