Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Solved] Extract a pattern using sed or cut Post 302763701 by mukulverma2408 on Wednesday 30th of January 2013 10:51:27 AM
Old 01-30-2013
[Solved] Extract a pattern using sed or cut

Hi,
Need help to extract a pattern using sed or cut or any other means.

Input
Code:
'name1',1234567890
'name2',2222222222
'name3',3333333333

Expected output
Code:
name1,1234567890
name2,2222222222
name3,3333333333

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help! Sed extract a pattern

I am trying to extract "securitySettings" out of line: <a ref ="http://localhost:5654/securitySettings"> using sed as follows: name = `grep "localhost" file.html | sed -n 's/.**\/\(.*)/\">/\1/p'` But it didn't run, seems have some syntax error. Do anybody knows why? Thank you very... (11 Replies)
Discussion started by: zhen
11 Replies

2. Shell Programming and Scripting

extract a string after a pattern using sed

I have a very large file and each line has a pattern and it is not position specific. I need to extract the string after the pattern ****MI* is the pattern in the red color 12 digit number is the sting value in the green color and it ends with ~ e.g. ... (1 Reply)
Discussion started by: gunaah
1 Replies

3. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

4. Shell Programming and Scripting

[solved] remove pattern with sed

Hi, i want to remove a certain pattern when i type pwd. pwd will look like this: ..../....../....../Pat_logs/..../....../...../...... the dotted lines are just random directory names, i want it to remove the "Pat_logs/...../....../....../" part so for example: ... (8 Replies)
Discussion started by: a27wang
8 Replies

5. UNIX for Dummies Questions & Answers

[Solved] deleting pattern based lines in sed

HI, My input file contains below data: DFHDR 12345110 1,200 2,-100 1,100 2,123 12345110 1,300 2,200 DFTLR In the above data, the first line and last lines should be remove as well as the lines in which contains 110 as position(6,7,8 position) should also be removed, How we... (0 Replies)
Discussion started by: pandeesh
0 Replies

6. Shell Programming and Scripting

[Solved] Find duplicate and add pattern in sed/awk

<Update> I have the solution: sed 's/\{3\}/&;&;---;4/' The thread can be marked as solved! </Update> Hi There, I'm working on a script processing some data from a website into cvs format. There is only one final problem left I can't find a solution. I've processed my file... (0 Replies)
Discussion started by: lolworlds
0 Replies

7. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

8. Shell Programming and Scripting

sed or awk, cut, to extract specific data from line

Hi guys, I have been trying to do this, but... no luck so maybe you can help me. I have a line like this: Total Handled, Received, on queue Input Mgs: 140 / 14 => 0 I need to, get the number after the / until the =, to get only 14 . Any help is greatly appreciated. Thanks, (4 Replies)
Discussion started by: ocramas
4 Replies

9. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

10. Shell Programming and Scripting

Extract whole word preceding a specific character pattern with first occurence of the pattern

Hello. Here is a file contents : declare -Ax NEW_FORCE_IGNORE_ARRAY=(="§" ="§" ="§" ="§" ="§" .................. ="§"Here is a pattern =I want to extract 'NEW_FORCE_IGNORE_ARRAY' which is the whole word before the first occurrence of pattern '=' Is there a better solution than mine :... (3 Replies)
Discussion started by: jcdole
3 Replies
symlink(2)							System Calls Manual							symlink(2)

Name
       symlink - make symbolic link to a file

Syntax
       symlink(name1, name2)
       char *name1, *name2;

Description
       A  symbolic link name2 is created to name1 (name2 is the name of the file created, name1 is the string used in creating the symbolic link).
       Either name can be an arbitrary path name.  The files need not be on the same file system.

Return Values
       Upon successful completion, a zero (0) value is returned.  If an error occurs, the error code is  stored  in  errno,  and  a  -1  value	is
       returned.

Diagnostics
       The symbolic link is made, unless one or more of the following are true:

       [ENOTDIR]      A component of the name2 prefix is not a directory.

       [EEXIST]       The name2 already exists.

       [EACCES]       A component of the name2 path prefix denies search permission.

       [EROFS]	      The file name2 would reside on a read-only file system.

       [EFAULT]       The name1 or name2 points outside the process's allocated address space.

       [ELOOP]	      Too many symbolic links were encountered in translating the pathname.

       [ENAMETOOLONG] A  component of either pathname exceeded MAXNAMELEN characters, or the entire length of either pathname exceeded MAXPATHNAME
		      characters.

       [ENOENT]       The named file does not exist.

       [EIO]	      An I/O error occurred while making the directory entry for name2, or allocating the inode for name2, or writing out the link
		      contents of name2.

       [ENOSPC]       The  directory  in  which  the entry for the new symbolic link is being placed cannot be extended, because there is no space
		      left on the file system containing the directory.

       [ENOSPC]       The new symbolic link cannot be created, because there is no space left on the file system that will  contain  the  symbolic
		      link.

       [ENOSPC]       There are no free inodes on the file system on which the symbolic link is being created.

       [EDQUOT]       The  directory  in  which the entry for the new symbolic link is being placed cannot be extended because the user's quota of
		      disk blocks on the file system containing the directory has been exhausted.

       [EDQUOT]       The new symbolic link cannot be created because the user's quota of disk blocks on the file system  that	will  contain  the
		      symbolic link has been exhausted.

       [EDQUOT]       The user's quota of inodes on the file system on which the user's symbolic link is being created has been exhausted.

       [EIO]	      An I/O error occurred while making the directory entry or allocating the inode.

       [ETIMEDOUT]    A  connect  request  or remote file operation failed, because the connected party did not properly respond after a period of
		      time that is dependent on the communications protocol.

See Also
       ln(1), link(2), readlink(2), stat(2), unlink(2)

																	symlink(2)
All times are GMT -4. The time now is 07:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy