Welcome to forums, please use code tags as per forum rules for commands/codes/Inputs which you are using into your posts. Could you please try following and let me know if this helps you.
Output will be as follows.
Thanks,
R. Singh
Hi,
I have a file named "Test_2008_01_21"
The file contains a string "manual" that occurs many times in the file
How can i find the positions of the string "manual" in the file
Ex: if the string " manual " occurs three times in the file. i want to replace the second occurance of string... (6 Replies)
Hi All,
My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Hi All,
My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
To trim 3rd field in for all the lines of a file and replace the modified string in that particular field.
For example i have a file called Temp.txt having content
Temp.txt
-----------------
100,234,M1234
400,234,K1734
300,345,T3456
----------------
So the modified file output should... (4 Replies)
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Hello everyone this is my first post of many to come :)
I am writing a script and in this script at one point i need to replace a character in a particular position in a string for example:
in the string "mystery" i would need to replace the 3rd position to an "r" so the string becomes... (3 Replies)
Hi
I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall:
E.g: Actual File content:
Hello
Name: Nitin Raj
Welcome to Unix... (4 Replies)
I asked this before, but my problem got more complicated. Heres what I am trying to do:
I'm trying to replace a string at a certain location with another string.
Heres the file I'm trying to change:
\E
I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Hi,
I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies
LEARN ABOUT OSF1
unexpand
expand(1) General Commands Manual expand(1)NAME
expand, unexpand - Replaces tab characters with spaces or spaces with tab characters
SYNOPSIS
Current syntax
expand [-t tablist] [file...]
unexpand [-a | -t tablist] [file...]
Obsolescent syntax
expand [-tabstop | -tab1,tab2,...,tabn] [file...]
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
expand: XCU5.0
unexpand: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Replaces spaces at the beginning of each line with a tab, and inserts tab characters wherever their presence compresses the resultant file
by replacing two or more characters. When the -t option is specified with the unexpand command, the -a option has no effect. (This option
applies to the unexpand command only.) Specifies the tab stops. The tablist argument consists of a single positive decimal integer or
multiple positive decimal integers, separated by spaces or commas, in ascending order. If a single number is specified, tabs are set tab-
list column positions apart instead of the default (8). If multiple numbers are specified, tabs are set at those specific column posi-
tions. Tabbing to tab stop position n thus causes the next character output to be in the (n+1)th column position on that line.
If expand has to process a tab character at a position beyond the last of those specified in a multiple tab stop list, the tab char-
acter is replaced by a single space in the output. Sets tab stops tabstop spaces apart instead of the default (8). (Obsolescent)
Sets tab stops at specified columns. (Obsolescent)
[Tru64 UNIX] Columns are measured in bytes.
OPERANDS
The path name of a file to be processed. If you do not specify this operand, standard input is read.
DESCRIPTION
The expand command changes tab characters to spaces in the named files, or the standard input, and writes the result to the standard out-
put.
The unexpand command puts tab characters into the data from the standard input, or the named files, and writes the result to the standard
output.
Backspace characters are preserved in the output and decrement the column count for tab calculations. The column position count cannot be
decremented below one. The expand command is useful for preprocessing character files (before sorting, looking at specific columns, and so
on.) that contain tab characters.
By default, unexpand converts only spaces that are within sequences of spaces and tab characters at the beginnings of lines. Use -a to
convert other sequences of spaces.
NOTES
If the expand command encounters difficulties opening any specified file, it writes an error message to standard error and terminates imme-
diately with an error status.
If the unexpand command encounters difficulties opening any specified file, it writes an error message to standard error and continues
operation. The exit status will reflect the error.
EXIT STATUS
The following exit values are returned by either command: Successful completion. An error occurred.
EXAMPLES
To replace tab characters in file with spaces, enter: expand file To replace the spaces in file with tab characters, enter: unexpand -a
file
ENVIRONMENT VARIABLES
The following environment variables affect the execution of expand and unexpand: Provides a default value for the internationalization
variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the inter-
nationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-
empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of
sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the
locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the
processing of LC_MESSAGES.
SEE ALSO
Commands: fold(1), tabs(1)
Standards: standards(5)expand(1)