Sponsored Content
Top Forums UNIX for Dummies Questions & Answers removing a character and addending to end in each line in a file Post 302162234 by arunkumar_mca on Monday 28th of January 2008 11:07:03 AM
Old 01-28-2008
removing a character and addending to end in each line in a file

HI i am having a file this

(sys19Smilienlfct:/pfact/temp>) cat temp_sand
1234567890
1234567890
1234567890
1234567890


I want to make this file as
(sys19Smilienlfct:/pfact/temp>) cat temp_sand
1456789023
1456789023
1456789023
1456789023


just take the 2nd and 3rd position and put it in end of ecah line . PLease let me know how to do that

Thanks,
Arun
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing character from list line (at the end)

Hi, I have file as shown below. abc, def, abc, xyz, I have to remove ',' from end of last line (xyz,). How can I do that with single command? Is it possible or I have to iterate through complete file to remove that? - Malay (2 Replies)
Discussion started by: malaymaru
2 Replies

2. UNIX for Advanced & Expert Users

Deleting end of line $ character in file

Hi, I've got a file where in the middle of the record is a $ end of line character, visible only when I open the file in vi and do :set list. How to I get rid of the character in the middle and keep it at the end. The middle $ character always appears after SW, so that can be used to tag it.... (3 Replies)
Discussion started by: bwrynz1
3 Replies

3. UNIX for Dummies Questions & Answers

How to add new line character at the end of a file

hi all, i have this question: How to add new line character at the end of a file???? i need this because i am loading a file to sybase and i have problems with the last record thanks for your help (5 Replies)
Discussion started by: DebianJ
5 Replies

4. Shell Programming and Scripting

append a character at end of each line of a file

Hi, i want to append a character '|' at end of each line of a file abc.txt. for example if the file abc.txt conatins: a|b|c 1|2|33 w|2|11 i want result file xyz.txt a|b|c| 1|2|33| w|2|11| I know this is simple but sumhow i am not able to reach end of line. its urgent, thanks for... (4 Replies)
Discussion started by: muaz
4 Replies

5. 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

6. Shell Programming and Scripting

add character to the end of each line in file

hi all i have 32 lines in file. the length of each line is 82 , i want that in the end of each line , means in postion 83-84 to put two characters 0d(=\015), 0a(=\012) i want that the 0d will be in postion 83 and the 0a will be in postion 84 in each line of the file how shall i do it ? ... (7 Replies)
Discussion started by: naamas03
7 Replies

7. UNIX for Dummies Questions & Answers

Removing ^@ character at the end own belowof Linux file

Hi, I have a Linux file which has content as sh (0 Replies)
Discussion started by: bhuvanas
0 Replies

8. Shell Programming and Scripting

add character to every end-of line in file

Hi All I have a file which conatins record.the length of every records is 47. problem : in the end of record i don't have a "\015" character. i want to add this "\015" charcter in the end of every record. the file contains something like 700 records. i've tried with sed command - nothing. ... (8 Replies)
Discussion started by: naamas03
8 Replies

9. Shell Programming and Scripting

How to remove new line character at end of file.

I need to remove new line character from end of file. Suppose here are content. a|b|c|d|r a|b|c|d|r a|b|c|d|r <new line> that means file contains 4 lines but data is there in 3 lines. so I want that only 3 lines should be there in file. Please help (20 Replies)
Discussion started by: varun940
20 Replies

10. Shell Programming and Scripting

Removing last character of a specific line from a file

Hello guys, I would need to remove the last character ")" of a specific line. This can be from any line. Your help is appreciated. Below is the line. HOSTNAME=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)) Please help. (6 Replies)
Discussion started by: sang8g
6 Replies
SG_IDENT(8)							     SG3_UTILS							       SG_IDENT(8)

NAME
sg_ident - send SCSI REPORT/SET IDENTIFYING INFORMATION command SYNOPSIS
sg_ident [--ascii] [--clear] [--help] [--itype=IT] [--raw] [--set] [--verbose] [--version] DEVICE DESCRIPTION
Send a SCSI REPORT IDENTIFYING INFORMATION or SET IDENTIFYING INFORMATION command to DEVICE. Prior to SPC-4 (revision 7) these commands were called REPORT DEVICE IDENTIFIER and SET DEVICE IDENTIFIER respectively. SCSI devices that support these two commands allow users to write (set) identifying information and report it back at some later time. The information is persistent (i.e. stored on some non-volatile medium within the SCSI device that will survive a power outage). Typically the space allocated for the information is limited: SPC-4 (revision 7) states that for information type 0, the minimum length is 64 bytes and the maximum is 512 bytes. For other information types (1 to 126 inclusive) the maximum length is 256 bytes. Also information types 1 to 126 (inclusive) should contain a null terminated UTF-8 string. The author has seen older disks that only support 16 bytes. The default action when no options are given is to invoke the Report Identifying Information command with the information type defaulting to zero. Error reports are sent to stderr. By default the information is shown in ASCII-HEX (up to 16 bytes per line) with an ASCII repre- sentation to the right with dots replacing non printable characters. OPTIONS
Arguments to long options are mandatory for short options as well. -A, --ascii invokes the Report Identifying Information command and if anything is found interprets it as ASCII (or UTF-8 depending on the locale) and prints the information to stdout. -C, --clear invokes the Set Identifying Information command with an information length of zero. This has the effect of clearing the existing information. -h, --help output the usage message then exit. -i, --itype=IT where IT is the information type. Defaults to zero. The maximum value is 127 which is special and cannot be used with --set or --clear. The information type of 127 (if supported) causes the REPORT IDENTIFYING INFORMATION command to respond with a list of available information types and their maximum lengths in bytes. The odd numbered information types between 3 and 125 (inclusive) are not to be used (as they clash with the SCC-2 standard). -r, --raw invokes the Report Identifying information command and if anything is found sends the information (which may be binary) to stdout. Nothing else is sent to stdout however error reports, if any, are sent to stderr. -S, --set first reads stdin until an EOF is detected then invokes the Set Identifying Information command to set what has been fetched from stdin as the information. The amount of data read must be between 1 and 512 bytes length (inclusive). -v, --verbose increase the level of verbosity, (i.e. debug output). -V, --version print the version string and then exit. This utility permits users to write their own identifying information to their SCSI devices. There are several other types of descriptors (or designators) that the user cannot change. These include the SCSI INQUIRY command with its standard vendor and product identification strings and the product revision level; plus the large amount of information provided by the "Device Identification" VPD page (see sg_vpd). There is also the READ MEDIA SERIAL NUMBER command (see sg_rmsn). The MMC-4 command set for CD and DVDs has a "media serial number" feature (0x109) [and a "logical unit serial number" feature]. These can be viewed with the sg_get_config utility. EXAMPLES
First, to see if there is an existing information whose format is unknown (for information type 0), use no options: # sg_ident /dev/sdb 00 31 32 33 34 35 36 37 38 39 30 1234567890 If it is ASCII then it can printed as such: # sg_ident --ascii /dev/sdb 1234567890 The information can be copied to a file, cleared and then re-asserted with this sequence: # sg_ident --raw /dev/sdb > t # sg_ident --clear /dev/sdb # cat t | sg_ident --set /dev/sdb EXIT STATUS
The exit status of sg_ident is 0 when it is successful. Otherwise see the sg3_utils(8) man page. AUTHORS
Written by Douglas Gilbert. REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>. COPYRIGHT
Copyright (C) 2005-2012 Douglas Gilbert This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_vpd(sg3_utils), sg_rmsn(sg3_utils), sg_get_config(sg3_utils) sg3_utils-1.35 November 2012 SG_IDENT(8)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy