Sponsored Content
Top Forums Shell Programming and Scripting How to print & and \n while replacing with sed/awk? Post 302997444 by dineshaila on Saturday 13th of May 2017 12:14:03 PM
Old 05-13-2017
I have tried escaping the & and \n
the output is
the name is din&esh
isgood

---------- Post updated at 11:14 AM ---------- Previous update was at 11:12 AM ----------

Hi Ravinder,
u r replacing the \n with blank.. but i need \n in the output



Also my input string will be dynamically changing
it may or may not have \n and &
it may have other regex
My output should display all the characters in string. it should be replaced with regex
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed - Replacing all date & time occurrences in a file with a string using Sed

Hi, I am new to using Sed. I have a file containg lines like the following: INFORM----Test.pc:168:10/11/05 12:34:26 > some text goes here.. TRACE-----Test.pc:197:10/11/05 12:34:26 > some text goes here.. My requirement is to replace 10/11/05 12:34:26 with a string <RUNDATE> (including <... (4 Replies)
Discussion started by: Hema_M
4 Replies

2. Shell Programming and Scripting

awk pipes & print

Hi, I need to awk some data from some text files, basic stuff, eg: awk '/phrase/ {print $1,$2,$3}' file Which will print columns 1 to 3 of all lines containing "phrase" But what if I wanted to pipe just one of the columns to a command (in my case a date converter) as in: awk... (4 Replies)
Discussion started by: Jonny2Vests
4 Replies

3. Shell Programming and Scripting

Replacing or removing a long list of pattern by using awk or sed

Input: >abc|123456|def|EXIT| >abc|203456|def|EXIT2| >abc|234056|def|EXIT3| >abc|340056|def|EXIT4| >abc|456000|def|EXIT5| . . . Output: def|EXIT| def|EXIT2| def|EXIT3| def|EXIT4| def|EXIT5| . . My try code: (9 Replies)
Discussion started by: patrick87
9 Replies

4. Shell Programming and Scripting

AWK - Pattern Matching & Replacing - Performance

Experts, I am a beginner to Unix Shell Scripting We have source as a flat file which contains CTRL+F character as the delimiter. We need to count the number of records in the file (CTRL+F) to perform file validation Following command being used: awk '{cnt+=gsub(//,"&")}END {print cnt}'... (4 Replies)
Discussion started by: srivijay81
4 Replies

5. Shell Programming and Scripting

awk: Multiple search patterns & print in an one liner

I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}' Can anybody help getting the right code? (10 Replies)
Discussion started by: sdf
10 Replies

6. Shell Programming and Scripting

Replacing FQDN by hostnames in a CSV file with sed & awk

Hello, Beginning with shell scipting, I'm trying to find in a csv file, the lines where the field related to hostname is displayed as an FQDN intead the hostname. (some lines are correct) and the to correct that inside the file: Novell,11.0,UNIX Server,bscpsiws02,TxffnX1tX1HiDoyBerrzWA==... (2 Replies)
Discussion started by: Wonto
2 Replies

7. Shell Programming and Scripting

awk Help: Filter Multiple Entry & print in one line.

AWK Gurus, data: srvhcm01 AZSCI srvhcm01 AZSDB srvhcm01 BZSDB srvhcm01 E2QDI31 srvhcm01 YPDCI srvhcm01 YPDDB srvhcm01 UV2FSCR srvhcm01 UV2FSBI srvhcm01 UV2FSXI srvhcm01 UV2FSUC srvhcm01 UV2FSEP srvhcm01 UV2FSRE srvhcm01 NASCI srvhcm01 NASDB srvhcm01 UV2FSSL srvhcm01 UV2FSDI (7 Replies)
Discussion started by: rveri
7 Replies

8. Shell Programming and Scripting

awk question: How to print condition of NR & NF together.

Experts: LINE1 :This is line one The FIRST line of the file. LINE2 :This is line two LINE3 :This is line three with 8 fileds LINE4 :This is line four LINE5 :This is line five LINE6 :This is line six with 8 fileds I want to delete line 1, and then process the file and want to print lines... (2 Replies)
Discussion started by: rveri
2 Replies

9. Shell Programming and Scripting

Replacing lines matching a multi-line pattern (sed/perl/awk)

Dear Unix Forums, I am hoping you can help me with a pattern matching problem. What am I trying to do? I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies

10. Shell Programming and Scripting

awk sed to repeat every character on same position from the upper line replacing whitespace

Hello is it possible with awk or sed to replace any white space with the previous line characters in the same position? I am asking this because the file I have doesn't always follow a pattern. For example the file I have is the result of a command to obtain windows ACLs: icacls C:\ /t... (5 Replies)
Discussion started by: nakaedu
5 Replies
UNSQUASHFS(1)						  uncompress squashfs filesystems					     UNSQUASHFS(1)

NAME
mksquashfs - tool to uncompress squashfs filesystems SYNOPSIS
unsquashfs [OPTIONS] FILESYSTEM [directories or files to extract] DESCRIPTION
Squashfs is a highly compressed read-only filesystem for Linux. It uses zlib compression to compress both files, inodes and directories. Inodes in the system are very small and all blocks are packed to minimize data overhead. Block sizes greater than 4K are supported up to a maximum of 64K. Squashfs is intended for general read-only filesystem use, for archival use (i.e. in cases where a .tar.gz file may be used), and in con- strained block device/memory systems (e.g. embedded systems) where low overhead is needed. OPTIONS
-v, -version print version, licence and copyright information. -d PATHNAME, -dest PATHNAME unsquash to PATHNAME, default "squashfs-root". -n, -no-progress don't display the progress bar. -no, -no-xattrs don't extract xattrs in file system. -x, -xattrs extract xattrs in file system (default). -p NUMBER, -processors NUMBER use NUMBER processors. By default will use number of processors available. -i, -info print files as they are unsquashed. -li, -linfo print files as they are unsquashed with file attributes (like ls -l output). -l, -ls list filesystem, but don't unsquash. -ll, -lls list filesystem with file attributes (like ls -l output), but don't unsquash. -f, -force if file already exists then overwrite. -s, -stat display filesystem superblock information. -e EXTRACT_FILE, -ef EXTRACT_FILE list of directories or files to extract. One per line. -da SIZE, -data-queue SIZE Set data queue to SIZE Mbytes. Default 256 Mbytes. -fr SIZE, -frag-queue SIZE Set fragment queue to SIZE Mbytes. Default 256 Mbytes. -r, -regex treat extract names as POSIX regular expressions rather than use the default shell wildcard expansion (globbing). Decompressors available gzip lzo xz SEE ALSO
mksquashfs(1) HOMEPAGE
More information about unsquashfs and the squashfs filesystem can be found at <http://squashfs.sourceforge.net/>. AUTHOR
squashfs was written by Phillip Lougher <plougher@users.sourceforge.net>. This manual page was written by Daniel Baumann <daniel.baumann@progress-technologies.net>. 4.2 2012-06-30 UNSQUASHFS(1)
All times are GMT -4. The time now is 05:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy