07-04-2012
Further to allister, if the here string in your Shell (whatever that is) had not appended a linefeed (thereby making the 4th character) the "wc" command would have seen nothing because it expects correctly formatted text files.
If you needed the answer three, you would have to subtract one from the result to eliminate count for the linefeed character.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
:rolleyes: Hi,
I want to replace the particular text in the middle of the line.
Ex. In the line 40-50 wanted to replace the char as 'x' (7 Replies)
Discussion started by: Jairaj
7 Replies
2. Shell Programming and Scripting
hi
i wanted to cut last 4 chars from a text file
Input
A-B-C-V-15-0115
A-BL-CLE-T-VALUE-0125
M-T-L-G-0115
AT-PR-PE-CCT-0135
Output
0115
0125
0115
0135
I tried cut -f - -d "-" (thinking cut -f 5- -d"-" gives 5 ot end of line so only - should give last but floped) (5 Replies)
Discussion started by: pbsrinivas
5 Replies
3. Shell Programming and Scripting
I was using the following bash command inside the emacs compile command to search C++ source code:
grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d'
Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies
4. UNIX for Dummies Questions & Answers
Hello, my name is Marc, I'm a linux starter :) and I hope you specialists can help me solving this issue.
I have a file containing a lot of data. Somewhere in this file, there's a string called "Faultdump", directly followed by 64 chars of HEX data. I need to get the HEX part. I accomplished... (12 Replies)
Discussion started by: Kally
12 Replies
5. Shell Programming and Scripting
I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :(
I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies
6. Programming
Hi, im trying to create a C program that will count the number of characters, duplicate characters and non duplicate characters in a file and output this to the screen. Here is my code so far:
#include <stdio.h>
int main( void )
{
char c;
int duplicate = 0;
int nonduplicate = 0;
int... (3 Replies)
Discussion started by: DavoMan
3 Replies
7. Shell Programming and Scripting
This reads single keystrokes and produces an output:
#! /bin/bash
while : ; do
read -s -n 1 >/dev/null 2>&1
echo ${REPLY}
done | awk '{print}'
This second one don't. Even though these examples make no sense; the real code is more complicated. Who knows what the problem is... (2 Replies)
Discussion started by: elbrand
2 Replies
8. UNIX for Dummies Questions & Answers
Howdy,
I need a command which will find all of the characters in a line before the first .
I am using Korn
Thank you (3 Replies)
Discussion started by: jgrosecl
3 Replies
9. UNIX for Advanced & Expert Users
Hello guys,
I have a problem where I need to add a delimiter, that can be | for example, after each 28000 chars.
The problem is that sometimes 1 row, which should contain 28000 chars is split in 2, so I want to put the delimiter after each 28000 so I will know the end of each row.
Please... (2 Replies)
Discussion started by: Diogo R Jesus
2 Replies
10. UNIX for Beginners Questions & Answers
Hi Team,
I have a file a1.txt with data as follows.
dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><!
The delimiter string: <SelectStatement modified='1' type='string'><!
dlm="<SelectStatement modified='1' type='string'><!
The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies
LEARN ABOUT PHP
mb_encode_mimeheader
MB_ENCODE_MIMEHEADER(3) 1 MB_ENCODE_MIMEHEADER(3)
mb_encode_mimeheader - Encode string for MIME header
SYNOPSIS
string m0],n[int_m$indent]) (string $str, [string $charset = mb_internal_encoding()], [string $transfer_encoding = "B"], [string $line-
feed = "
DESCRIPTION
Encodes a given string$str by the MIME header encoding scheme.
PARAMETERS
o $str
- The string being encoded.
o $charset
-$charset specifies the name of the character set in which $str is represented in. The default value is determined by the current
NLS setting ( mbstring.language). mb_internal_encoding(3) should be set to same encoding.
o $transfer_encoding
-$transfer_encoding specifies the scheme of MIME encoding. It should be either "B" (Base64) or "Q" (Quoted-Printable). Falls back
to "B" if not given.
o $linefeed
-$linefeed specifies the EOL (end-of-line) marker with which mb_encode_mimeheader(3) performs line-folding (a RFC term, the act of
breaking a line longer than a certain length into multiple lines. The length is currently hard-coded to 74 characters). Falls back
to "
" (CRLF) if not given.
o $indent
- Indentation of the first line (number of characters in the header before $str).
RETURN VALUES
A converted version of the string represented in ASCII.
EXAMPLES
Example #1
mb_encode_mimeheader(3) example
<?php
$name = ""; // kanji
$mbox = "kru";
$doma = "gtinn.mon";
$addr = mb_encode_mimeheader($name, "UTF-7", "Q") . " <" . $mbox . "@" . $doma . ">";
echo $addr;
?>
NOTES
Note
This function isn't designed to break lines at higher-level contextual break points (word boundaries, etc.). This behaviour may
clutter up the original string with unexpected spaces.
SEE ALSO
mb_decode_mimeheader(3).
PHP Documentation Group MB_ENCODE_MIMEHEADER(3)