Skip to main content
edited tags
Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262
added 39 characters in body
Source Link
Max
  • 199
  • 2
  • 9

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the coming lines loses the wanted formatting.

$ find src/ -name "*.js" | xargs grep --null -E -n 'filter\(|map\(' | xargs -0 printf "%-100s%-5s%-100s" > test.txt

The output is as follows: (scroll right to see the complete line)

src/components/AppRouterSwitch.js                                                                   15:    return _Routes.map((route, index) => {
src/components/forms/UserEditForm/UserEditForm.js36:    const options = UserTypes.map((type, index) => <option key={index} value={type.type}>{type.name}</option>);
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js119:        templates:state.templates.filter(item=>item.SOLUTIONID ==id)
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js120:            .map(item=>{return{

The first row looks just as I want it. The following loses the desired formatting. Ending the printf format string with /n doesn't do the trick.

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the coming lines loses the wanted formatting.

$ find src/ -name "*.js" | xargs grep --null -E -n 'filter\(|map\(' | xargs -0 printf "%-100s%-5s%-100s" > test.txt

The output is as follows:

src/components/AppRouterSwitch.js                                                                   15:    return _Routes.map((route, index) => {
src/components/forms/UserEditForm/UserEditForm.js36:    const options = UserTypes.map((type, index) => <option key={index} value={type.type}>{type.name}</option>);
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js119:        templates:state.templates.filter(item=>item.SOLUTIONID ==id)
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js120:            .map(item=>{return{

The first row looks just as I want it. The following loses the desired formatting. Ending the printf format string with /n doesn't do the trick.

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the coming lines loses the wanted formatting.

$ find src/ -name "*.js" | xargs grep --null -E -n 'filter\(|map\(' | xargs -0 printf "%-100s%-5s%-100s" > test.txt

The output is as follows: (scroll right to see the complete line)

src/components/AppRouterSwitch.js                                                                   15:    return _Routes.map((route, index) => {
src/components/forms/UserEditForm/UserEditForm.js36:    const options = UserTypes.map((type, index) => <option key={index} value={type.type}>{type.name}</option>);
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js119:        templates:state.templates.filter(item=>item.SOLUTIONID ==id)
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js120:            .map(item=>{return{

The first row looks just as I want it. The following loses the desired formatting. Ending the printf format string with /n doesn't do the trick.

deleted 85 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 239

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the coming lines loses the wanted formatting.

$ find src/ -name "*.js" | xargs grep --null -E -n 'filter\(|map\(' | xargs -0 printf "%-100s%-5s%-100s" > test.txt

The output is as follows:

src/components/AppRouterSwitch.js                                                                   15:    return _Routes.map((route, index) => {
src/components/forms/UserEditForm/UserEditForm.js36:    const options = UserTypes.map((type, index) => <option key={index} value={type.type}>{type.name}</option>);
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js119:        templates:state.templates.filter(item=>item.SOLUTIONID ==id)
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js120:            .map(item=>{return{

The first row looks just as I want it. The following loses the desired formatting. Ending the printf format string with /n doesn't do the trick.

I might be over complicating, in that case please put me in the right direction.

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the coming lines loses the wanted formatting.

$ find src/ -name "*.js" | xargs grep --null -E -n 'filter\(|map\(' | xargs -0 printf "%-100s%-5s%-100s" > test.txt

The output is as follows:

src/components/AppRouterSwitch.js                                                                   15:    return _Routes.map((route, index) => {
src/components/forms/UserEditForm/UserEditForm.js36:    const options = UserTypes.map((type, index) => <option key={index} value={type.type}>{type.name}</option>);
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js119:        templates:state.templates.filter(item=>item.SOLUTIONID ==id)
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js120:            .map(item=>{return{

The first row looks just as I want it. The following loses the desired formatting. Ending the printf format string with /n doesn't do the trick.

I might be over complicating, in that case please put me in the right direction.

I want to search my code base for ocurrences of a string, and then get the formatted output as filename, line number, and code lide. I got it as I wanted on the first line of the output, but the coming lines loses the wanted formatting.

$ find src/ -name "*.js" | xargs grep --null -E -n 'filter\(|map\(' | xargs -0 printf "%-100s%-5s%-100s" > test.txt

The output is as follows:

src/components/AppRouterSwitch.js                                                                   15:    return _Routes.map((route, index) => {
src/components/forms/UserEditForm/UserEditForm.js36:    const options = UserTypes.map((type, index) => <option key={index} value={type.type}>{type.name}</option>);
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js119:        templates:state.templates.filter(item=>item.SOLUTIONID ==id)
src/components/pages/AdminPage/SolutionManagementEditPage/SolutionManagementEditPage.js120:            .map(item=>{return{

The first row looks just as I want it. The following loses the desired formatting. Ending the printf format string with /n doesn't do the trick.

Source Link
Max
  • 199
  • 2
  • 9
Loading