Sponsored Content
Top Forums Shell Programming and Scripting Cutting a part of line till delimiter Post 302586051 by birei on Friday 30th of December 2011 04:29:00 AM
Old 12-30-2011
Hi vivek d r,

Try if this could work for you. It deletes all lines which end with ',' and for those which not, deletes dealing and trailing spaces:
Code:
$ perl -ne 'unless ( /,\s*$/ ) { s/^\s*//; s/\s*$//; printf qq[%s\n], $_ }' infile
KEY `deviceId` (`deviceId`)
PRIMARY KEY (`id`)

Regards,
Birei
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cutting part of string

Hi, I wanted to cut a specific portion from given string. How would I do that? Example: /u09/core/inbound/abc.txt is my string. I want abc.txt in a variable. Please help me. Regards, Dhaval (3 Replies)
Discussion started by: dhaval_khamar
3 Replies

2. UNIX for Dummies Questions & Answers

cutting columns if delimiter has more than one charecter

Hi, My file looks like abc$%sdfhs$%sdf$%sdfaf$% here as seen delimiter is $%...now how cas i take out second field as cut command expect delimiter as single charecter only.....is there is any other way thanks and regards mahabunta (9 Replies)
Discussion started by: mahabunta
9 Replies

3. Shell Programming and Scripting

Cutting a tab delimiter file

I have a 30 column tab delimited record file. I need to extract the first 10column. The following command to cut was not working cut -f 1-10 -d "\t" filename. Could any one keep on this . Thanks in Advance (4 Replies)
Discussion started by: vinod.thayil
4 Replies

4. UNIX for Dummies Questions & Answers

Cutting a portion of a line seperated by pipe delimiter

Hi, In the below line a|b|10065353|tefe|rhraqs|135364|5347575 dgd|rg|4333|fhra|grhrt|46423|urdsgd Here i want to cut the characters in between the second and third pipe delimiter and then between fifth and sixth delimiter and retain the rest of the line. My output should be ... (3 Replies)
Discussion started by: ragavhere
3 Replies

5. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

6. UNIX for Dummies Questions & Answers

cutting columns if delimiter has more than one charecter (|^)

Hi All, I am having a file with the delimiter '|^'. File name:test_dlim.csv I want to cut the first field of this using awk command. I tried with the help of the following link:... (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

7. Shell Programming and Scripting

Cutting Part of Output

Hello all I'm using bourne shell and need to figure out how to cut out a specific portion of some output. For example, my output from my command is: 12.12.52.125.in-addr.arpa name = hostname.domain.main.gov I need to get just the "hostname.domain.main.gov" part. What I'm trying... (9 Replies)
Discussion started by: lee.n.doan
9 Replies

8. Shell Programming and Scripting

Any shell scripts for cutting and pasting part of data?

Hi, I have a tab-delimited txt file as below. It is part of the original file. I want to cut the lines starting with "3" in column1 and paste them before the lines starting with "1" in column 1. So I will get Anyone knows any simple shell scripts to do that? The original file is... (5 Replies)
Discussion started by: cliffyiu
5 Replies

9. Shell Programming and Scripting

Cutting a string using more than one character as delimiter

Hi , I have a set of files in a folder which i need to cut in to two parts.... Sample files touch AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT touch AE_JUNFOR_2014_YTD_2013-05-30-03-30-02.TXT touch temp_AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT touch... (4 Replies)
Discussion started by: chillblue
4 Replies

10. Shell Programming and Scripting

Cutting values with delimiter

Hi All, I have a string with , delimiter america,finland,netherlands Now i want these values to be stored in file as below with newline character at end of each value america finland netherlands Regards Prasad (3 Replies)
Discussion started by: krishna_gnv
3 Replies
SYNCE-REGISTRY(1)					   http://synce.sourceforge.net/					 SYNCE-REGISTRY(1)

NAME
synce-registry - read or modify the registry on a PDA SYNOPSIS
synce-registry [-d LEVEL] [-p DEVNAME] [-h] [-r] PARENTKEY KEY VALUE -w [-t TYPE] PARENTKEY KEY VALUE NEWVALUE -l PARENTKEY KEY -n PARENTKEY NEWKEY -x PARENTKEY KEY VALUE (not supported) -X PARENTKEY KEY (not supported) DESCRIPTION
synce-registry manipulates the registry on a device connected through SynCE. It can read and write values, add new keys and values, and list the values of a key. Forward slashes ('/') in key names specified on the command line are converted to backward slashes (''). This tool must be run as the same user as the dccmd daemon. OPTIONS
-d LEVEL Set debug log level: 0 - No logging (default) 1 - Errors only 2 - Errors and warnings 3 - Everything -p DEVNAME Use the device with the given name, instead of the default. -h Display help message. [-r] PARENTKEY KEY VALUE Read a value. This is the default. -w [-t TYPE] PARENTKEY KEY VALUE NEWVALUE Write a value. If TYPE is supplied, that type of value will be written; otherwise a string. The following options are valid for TYPE: sz - String dword - Double-word (4 bytes) dword_bige - Double word (4 bytes), big-endian expand_sz - String with path expansion multi_sz - Multiple strings (not supported) binary - Binary data (not supported) -l PARENTKEY KEY List the names of values and subkeys in the given KEY. -n PARENTKEY KEY Create a new key. -x PARENTKEY KEY VALUE Delete the given VALUE from the given KEY. (not implemented) -X PARENTKEY KEY Delete the given KEY. (not implemented) PARENTKEY The top-level key (sometimes called the hive). The only valid options are HKEY_CLASSES_ROOT (abbreviated HKCR), HKEY_CURRENT_USER (HKCU), HKEY_LOCAL_MACHINE (HKLM), and HKEY_USERS (HKU). KEY The key to operate on. A key can contain zero or more values and subkeys. VALUE The value to operate on. NEWVALUE The new value to set VALUE to in a write operation. AUTHOR
David Eriksson <twogood@users.sourceforge.net>, Scott Gifford <gifford@umich.edu>. SEE ALSO
synce(1) pstatus(1) The SynCE project March 2006 SYNCE-REGISTRY(1)
All times are GMT -4. The time now is 02:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy