09-28-2001
Delete first 2 character from string
Hi ! All,
I have to delete first 2 characters from string. How its possible?
Like string value is "2001". I required output as "01"
Plaese help me.
Nitin
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
If I have a string defined as:
MyString=abcde
echo $MyString
How can I loop through it character by character? I haven't been able to find a way to index the string so that I loop through it.
shew01 (10 Replies)
Discussion started by: shew01
10 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have a .txt and I need to delete the characters betwwen the 10th and 20th...
How can I do that...
I need to do somethink like these:
%s/I don't know how to define a range between 10th and 20th character//g
Can you help me...
If I want the 10 first characters i do this:... (2 Replies)
Discussion started by: nuno_fbo
2 Replies
3. Shell Programming and Scripting
I would like to remove characters from column 7 so that from an input file looking like this:
>HWI-EAS422_12:4:1:69:89 GGTTTAAATATTGCACAAAAGGTATAGAGCGT U0 1 0 0 ref_chr8.fa 6527777 F DD
I get something like that in an output file:
... (13 Replies)
Discussion started by: matlavmac
13 Replies
4. Shell Programming and Scripting
Hello all,
I have a file containing the following
p1 q1 p2 q2 p1 p2 p3
pr1 pr2 pr1 pr2
pa1 pa2
I want to remove the last character from all strings that start with 'p' and end with '1'. In general, I do not know what is between the first part of the string and the last part of the string.... (4 Replies)
Discussion started by: bigfoot
4 Replies
5. Shell Programming and Scripting
Hallo!
Example.
#!/bin/bash
BACKUP_DIR=/home/userx/backups/evolution
echo $BACKUP_DIR
# delete the first character from the string
BACKUP_DIR=$(echo $BACKUP_DIR | cut -c 2-)
echo $BACKUP_DIR
It works. It does want I want, delete the first character from string in the... (11 Replies)
Discussion started by: linuxinho
11 Replies
6. Shell Programming and Scripting
Hi,
1_strings file contains
$ cat 1_strings
/home/$USER/Src
/home/Valid
/home/Review$ cat myxml
<projected value="some string" path="/home/$USER/Src">
<input 1/>
<estimate value/>
<somestring/>
</projected>
<few more lines >
<projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies
7. Shell Programming and Scripting
Hi there,
A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis).
The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies
8. Shell Programming and Scripting
Hi,
Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank.
Text file :
"1"|"ExternalClassDEA519CF5"|"Art1"
"2"|"ExternalClass563EA516C"|"Art3"
"3"|"ExternalClass305ED16B8"|"Art9"
...
...
... (2 Replies)
Discussion started by: fspalero
2 Replies
9. Shell Programming and Scripting
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
10. UNIX for Beginners Questions & Answers
I wrote a shell script program that supposed to delete any directories and its files that begin with the same character string . The program is designed to delete directories and its files that are one day old or less and only the directories that begin with the same character string. The problem... (1 Reply)
Discussion started by: dellanicholson
1 Replies
LEARN ABOUT OPENDARWIN
wc
WC(1) BSD General Commands Manual WC(1)
NAME
wc -- word, line, character, and byte count
SYNOPSIS
wc [-clmw] [file ...]
DESCRIPTION
The wc utility displays the number of lines, words, and bytes contained in each input file (or standard input, by default) to the standard
output. A line is defined as a string of characters delimited by a <newline> character, and a word is defined as a string of characters
delimited by white space characters. White space characters are the set of characters for which the iswspace(3) function returns true. If
more than one input file is specified, a line of cumulative counts for all the files is displayed on a separate line after the output for the
last file.
The following options are available:
-c The number of bytes in each input file is written to the standard output.
-l The number of lines in each input file is written to the standard output.
-m The number of characters in each input file is written to the standard output. If the current locale does not support multibyte
characters, this is equivalent to the -c option.
-w The number of words in each input file is written to the standard output.
When an option is specified, wc only reports the information requested by that option. The default action is equivalent to specifying the
-c, -l and -w options.
If no files are specified, the standard input is used and no file name is displayed.
ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of wc as described in environ(7).
EXAMPLES
Count the number of characters, words and lines in each of the files report1 and report2 as well as the totals for both:
wc -mlw report1 report2
DIAGNOSTICS
The wc utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
iswspace(3)
COMPATIBILITY
Historically, the wc utility was documented to define a word as a ``maximal string of characters delimited by <space>, <tab> or <newline>
characters''. The implementation, however, didn't handle non-printing characters correctly so that `` ^D^E '' counted as 6 spaces, while
``foo^D^Ebar'' counted as 8 characters. 4BSD systems after 4.3BSD modified the implementation to be consistent with the documentation. This
implementation defines a ``word'' in terms of the iswspace(3) function, as required by IEEE Std 1003.2 (``POSIX.2'').
STANDARDS
The wc utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'').
HISTORY
A wc command appeared in Version 1 AT&T UNIX.
BSD
June 13, 2002 BSD